Commit e95cff03 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Always update the DC before looking for the physdev pointer.

parent 7eb0d62b
......@@ -518,7 +518,6 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop
if ((dc = get_dc_ptr( hdc )))
{
struct bitblt_coords dst;
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPatBlt );
update_dc( dc );
......@@ -538,8 +537,11 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop
hdc, dst.log_x, dst.log_y, dst.log_width, dst.log_height,
dst.x, dst.y, dst.width, dst.height, wine_dbgstr_rect(&dst.visrect), rop );
if (!ret) ret = physdev->funcs->pPatBlt( physdev, &dst, rop );
if (!ret)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPatBlt );
ret = physdev->funcs->pPatBlt( physdev, &dst, rop );
}
release_dc_ptr( dc );
}
return ret;
......@@ -574,8 +576,6 @@ BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst, INT widthDst, INT height
if ((dcSrc = get_dc_ptr( hdcSrc )))
{
struct bitblt_coords src, dst;
PHYSDEV src_dev = GET_DC_PHYSDEV( dcSrc, pStretchBlt );
PHYSDEV dst_dev = GET_DC_PHYSDEV( dcDst, pStretchBlt );
update_dc( dcSrc );
update_dc( dcDst );
......@@ -604,7 +604,12 @@ BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst, INT widthDst, INT height
hdcDst, dst.log_x, dst.log_y, dst.log_width, dst.log_height,
dst.x, dst.y, dst.width, dst.height, wine_dbgstr_rect(&dst.visrect), rop );
if (!ret) ret = dst_dev->funcs->pStretchBlt( dst_dev, &dst, src_dev, &src, rop );
if (!ret)
{
PHYSDEV src_dev = GET_DC_PHYSDEV( dcSrc, pStretchBlt );
PHYSDEV dst_dev = GET_DC_PHYSDEV( dcDst, pStretchBlt );
ret = dst_dev->funcs->pStretchBlt( dst_dev, &dst, src_dev, &src, rop );
}
release_dc_ptr( dcSrc );
}
release_dc_ptr( dcDst );
......@@ -911,8 +916,6 @@ BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heig
if ((dcDst = get_dc_ptr( hdcDst )))
{
struct bitblt_coords src, dst;
PHYSDEV src_dev = GET_DC_PHYSDEV( dcSrc, pAlphaBlend );
PHYSDEV dst_dev = GET_DC_PHYSDEV( dcDst, pAlphaBlend );
update_dc( dcSrc );
update_dc( dcDst );
......@@ -921,12 +924,12 @@ BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heig
src.log_y = ySrc;
src.log_width = widthSrc;
src.log_height = heightSrc;
src.layout = GetLayout( src_dev->hdc );
src.layout = GetLayout( hdcSrc );
dst.log_x = xDst;
dst.log_y = yDst;
dst.log_width = widthDst;
dst.log_height = heightDst;
dst.layout = GetLayout( dst_dev->hdc );
dst.layout = GetLayout( hdcDst );
ret = !get_vis_rectangles( dcDst, &dst, dcSrc, &src );
TRACE("src %p log=%d,%d %dx%d phys=%d,%d %dx%d vis=%s dst %p log=%d,%d %dx%d phys=%d,%d %dx%d vis=%s blend=%02x/%02x/%02x/%02x\n",
......@@ -962,8 +965,12 @@ BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heig
SetLastError( ERROR_INVALID_PARAMETER );
ret = FALSE;
}
else if (!ret) ret = dst_dev->funcs->pAlphaBlend( dst_dev, &dst, src_dev, &src, blendFunction );
else if (!ret)
{
PHYSDEV src_dev = GET_DC_PHYSDEV( dcSrc, pAlphaBlend );
PHYSDEV dst_dev = GET_DC_PHYSDEV( dcDst, pAlphaBlend );
ret = dst_dev->funcs->pAlphaBlend( dst_dev, &dst, src_dev, &src, blendFunction );
}
release_dc_ptr( dcDst );
}
release_dc_ptr( dcSrc );
......
......@@ -250,18 +250,17 @@ INT WINAPI SelectClipRgn( HDC hdc, HRGN hrgn )
*/
INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT fnMode )
{
INT retval = ERROR;
PHYSDEV physdev;
INT retval;
DC * dc = get_dc_ptr( hdc );
TRACE("%p %p %d\n", hdc, hrgn, fnMode );
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pExtSelectClipRgn );
update_dc( dc );
retval = physdev->funcs->pExtSelectClipRgn( physdev, hrgn, fnMode );
release_dc_ptr( dc );
}
if (!dc) return ERROR;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pExtSelectClipRgn );
retval = physdev->funcs->pExtSelectClipRgn( physdev, hrgn, fnMode );
release_dc_ptr( dc );
return retval;
}
......@@ -298,18 +297,17 @@ void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect,
*/
INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y )
{
INT ret = ERROR;
PHYSDEV physdev;
INT ret;
DC *dc = get_dc_ptr( hdc );
TRACE("%p %d,%d\n", hdc, x, y );
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pOffsetClipRgn );
update_dc( dc );
ret = physdev->funcs->pOffsetClipRgn( physdev, x, y );
release_dc_ptr( dc );
}
if (!dc) return ERROR;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pOffsetClipRgn );
ret = physdev->funcs->pOffsetClipRgn( physdev, x, y );
release_dc_ptr( dc );
return ret;
}
......@@ -320,18 +318,17 @@ INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y )
INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
INT right, INT bottom )
{
INT ret = ERROR;
PHYSDEV physdev;
INT ret;
DC *dc = get_dc_ptr( hdc );
TRACE("%p %d,%d-%d,%d\n", hdc, left, top, right, bottom );
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pExcludeClipRect );
update_dc( dc );
ret = physdev->funcs->pExcludeClipRect( physdev, left, top, right, bottom );
release_dc_ptr( dc );
}
if (!dc) return ERROR;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pExcludeClipRect );
ret = physdev->funcs->pExcludeClipRect( physdev, left, top, right, bottom );
release_dc_ptr( dc );
return ret;
}
......@@ -341,18 +338,17 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
*/
INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
{
INT ret = ERROR;
PHYSDEV physdev;
INT ret;
DC *dc = get_dc_ptr( hdc );
TRACE("%p %d,%d - %d,%d\n", hdc, left, top, right, bottom );
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pIntersectClipRect );
update_dc( dc );
ret = physdev->funcs->pIntersectClipRect( physdev, left, top, right, bottom );
release_dc_ptr( dc );
}
if (!dc) return ERROR;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pIntersectClipRect );
ret = physdev->funcs->pIntersectClipRect( physdev, left, top, right, bottom );
release_dc_ptr( dc );
return ret;
}
......
......@@ -537,14 +537,15 @@ INT WINAPI SaveDC( HDC hdc )
*/
BOOL WINAPI RestoreDC( HDC hdc, INT level )
{
PHYSDEV physdev;
DC *dc;
BOOL success = FALSE;
TRACE("%p %d\n", hdc, level );
if ((dc = get_dc_ptr( hdc )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRestoreDC );
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pRestoreDC );
success = physdev->funcs->pRestoreDC( physdev, level );
release_dc_ptr( dc );
}
......
......@@ -603,6 +603,7 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst, INT heightDs
{
char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
BITMAPINFO *info = (BITMAPINFO *)buffer;
PHYSDEV physdev;
DC *dc;
INT ret = 0;
......@@ -615,8 +616,8 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst, INT heightDs
if ((dc = get_dc_ptr( hdc )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pStretchDIBits );
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pStretchDIBits );
ret = physdev->funcs->pStretchDIBits( physdev, xDst, yDst, widthDst, heightDst,
xSrc, ySrc, widthSrc, heightSrc, bits, info, coloruse, rop );
release_dc_ptr( dc );
......@@ -875,6 +876,7 @@ INT WINAPI SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx,
{
char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
BITMAPINFO *info = (BITMAPINFO *)buffer;
PHYSDEV physdev;
INT ret = 0;
DC *dc;
......@@ -887,8 +889,8 @@ INT WINAPI SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx,
if ((dc = get_dc_ptr( hdc )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDIBitsToDevice );
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pSetDIBitsToDevice );
ret = physdev->funcs->pSetDIBitsToDevice( physdev, xDest, yDest, cx, cy, xSrc,
ySrc, startscan, lines, bits, info, coloruse );
release_dc_ptr( dc );
......
......@@ -1121,16 +1121,15 @@ INT WINAPI Escape( HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out
INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
INT cbOutput, LPSTR lpszOutData )
{
INT ret = 0;
PHYSDEV physdev;
INT ret;
DC * dc = get_dc_ptr( hdc );
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pExtEscape );
update_dc( dc );
ret = physdev->funcs->pExtEscape( physdev, nEscape, cbInput, lpszInData, cbOutput, lpszOutData );
release_dc_ptr( dc );
}
if (!dc) return 0;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pExtEscape );
ret = physdev->funcs->pExtEscape( physdev, nEscape, cbInput, lpszInData, cbOutput, lpszOutData );
release_dc_ptr( dc );
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment