From 1ac1d7c69b5c2d832922727a832eb70f48d1a997 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 11 Jul 2011 13:59:05 +0200 Subject: [PATCH] gdi32: Pass the dest visible rectangle to the PatBlt driver entry point. --- dlls/gdi32/bitblt.c | 28 +++++++++++++++++++----- dlls/gdi32/dibdrv/dibdrv.h | 2 +- dlls/gdi32/dibdrv/graphics.c | 11 +++++----- dlls/gdi32/driver.c | 2 +- dlls/gdi32/enhmfdrv/bitblt.c | 19 ++++++++--------- dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 3 +-- dlls/gdi32/gdi_private.h | 2 +- dlls/gdi32/mfdrv/bitblt.c | 5 +++-- dlls/gdi32/mfdrv/metafiledrv.h | 3 +-- dlls/wineps.drv/bitblt.c | 20 +++++++---------- dlls/wineps.drv/wineps.drv.spec | 2 +- dlls/winex11.drv/bitblt.c | 32 ++++++---------------------- dlls/winex11.drv/winex11.drv.spec | 2 +- 13 files changed, 61 insertions(+), 70 deletions(-) diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index 9ed191bb920..f065290b473 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -214,19 +214,37 @@ BOOL CDECL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop) { DC * dc; - BOOL bRet = FALSE; - - TRACE("%p %d,%d %dx%d %06x\n", hdc, left, top, width, height, rop ); + BOOL ret = FALSE; if (rop_uses_src( rop )) return FALSE; if ((dc = get_dc_ptr( hdc ))) { + struct bitblt_coords dst; PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPatBlt ); + update_dc( dc ); - bRet = physdev->funcs->pPatBlt( physdev, left, top, width, height, rop ); + + dst.log_x = left; + dst.log_y = top; + dst.log_width = width; + dst.log_height = height; + dst.layout = dc->layout; + if (rop & NOMIRRORBITMAP) + { + dst.layout |= LAYOUT_BITMAPORIENTATIONPRESERVED; + rop &= ~NOMIRRORBITMAP; + } + get_vis_rectangles( dc, &dst, NULL, NULL ); + + TRACE("dst %p log=%d,%d %dx%d phys=%d,%d %dx%d vis=%s rop=%06x\n", + 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 ); + + ret = physdev->funcs->pPatBlt( physdev, &dst, rop ); + release_dc_ptr( dc ); } - return bRet; + return ret; } diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 2e0cadf25b4..9fde40af681 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -19,7 +19,7 @@ */ extern BOOL CDECL dibdrv_LineTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern BOOL CDECL dibdrv_PatBlt( PHYSDEV dev, INT x, INT y, INT width, INT height, DWORD rop ) DECLSPEC_HIDDEN; +extern BOOL CDECL dibdrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; extern BOOL CDECL dibdrv_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN; extern BOOL CDECL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern HBRUSH CDECL dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c index 7f7746f8a44..b4280582dc9 100644 --- a/dlls/gdi32/dibdrv/graphics.c +++ b/dlls/gdi32/dibdrv/graphics.c @@ -93,27 +93,26 @@ static inline INT get_rop2_from_rop(INT rop) /*********************************************************************** * dibdrv_PatBlt */ -BOOL CDECL dibdrv_PatBlt( PHYSDEV dev, INT x, INT y, INT width, INT height, DWORD rop ) +BOOL CDECL dibdrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) { PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPatBlt ); dibdrv_physdev *pdev = get_dibdrv_pdev(dev); INT rop2 = get_rop2_from_rop(rop); - RECT rect = get_device_rect( dev->hdc, x, y, x + width, y + height, TRUE ); BOOL done; - TRACE("(%p, %d, %d, %d, %d, %06x)\n", dev, x, y, width, height, rop); + TRACE("(%p, %d, %d, %d, %d, %06x)\n", dev, dst->x, dst->y, dst->width, dst->height, rop); if(defer_brush(pdev)) - return next->funcs->pPatBlt( next, x, y, width, height, rop ); + return next->funcs->pPatBlt( next, dst, rop ); update_brush_rop( pdev, rop2 ); - done = pdev->brush_rects( pdev, 1, &rect ); + done = pdev->brush_rects( pdev, 1, &dst->visrect ); update_brush_rop( pdev, GetROP2(dev->hdc) ); if(!done) - return next->funcs->pPatBlt( next, x, y, width, height, rop ); + return next->funcs->pPatBlt( next, dst, rop ); return TRUE; } diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 13bd7bd518f..2be12b8f0bf 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -521,7 +521,7 @@ static BOOL CDECL nulldrv_PaintRgn( PHYSDEV dev, HRGN rgn ) return TRUE; } -static BOOL CDECL nulldrv_PatBlt( PHYSDEV dev, INT x, INT y, INT width, INT height, DWORD rop ) +static BOOL CDECL nulldrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) { return TRUE; } diff --git a/dlls/gdi32/enhmfdrv/bitblt.c b/dlls/gdi32/enhmfdrv/bitblt.c index 698d30f7f37..abf22c12d84 100644 --- a/dlls/gdi32/enhmfdrv/bitblt.c +++ b/dlls/gdi32/enhmfdrv/bitblt.c @@ -27,22 +27,21 @@ #include "enhmetafiledrv.h" #include "wine/debug.h" -BOOL CDECL EMFDRV_PatBlt( PHYSDEV dev, INT left, INT top, - INT width, INT height, DWORD rop ) +BOOL CDECL EMFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) { EMRBITBLT emr; BOOL ret; emr.emr.iType = EMR_BITBLT; emr.emr.nSize = sizeof(emr); - emr.rclBounds.left = left; - emr.rclBounds.top = top; - emr.rclBounds.right = left + width - 1; - emr.rclBounds.bottom = top + height - 1; - emr.xDest = left; - emr.yDest = top; - emr.cxDest = width; - emr.cyDest = height; + emr.rclBounds.left = dst->log_x; + emr.rclBounds.top = dst->log_y; + emr.rclBounds.right = dst->log_x + dst->log_width - 1; + emr.rclBounds.bottom = dst->log_y + dst->log_height - 1; + emr.xDest = dst->log_x; + emr.yDest = dst->log_y; + emr.cxDest = dst->log_width; + emr.cyDest = dst->log_height; emr.dwRop = rop; emr.xSrc = 0; emr.ySrc = 0; diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h index 4cdaa6fea65..f8d389a1295 100644 --- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h +++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h @@ -98,8 +98,7 @@ extern INT CDECL EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC extern BOOL CDECL EMFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN; -extern BOOL CDECL EMFDRV_PatBlt( PHYSDEV dev, INT left, INT top, - INT width, INT height, DWORD rop ) DECLSPEC_HIDDEN; +extern BOOL CDECL EMFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index ef591e3fdc3..feb30f82827 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -206,7 +206,7 @@ typedef struct gdi_dc_funcs BOOL (CDECL *pOffsetViewportOrgEx)(PHYSDEV,INT,INT,POINT*); BOOL (CDECL *pOffsetWindowOrgEx)(PHYSDEV,INT,INT,POINT*); BOOL (CDECL *pPaintRgn)(PHYSDEV,HRGN); - BOOL (CDECL *pPatBlt)(PHYSDEV,INT,INT,INT,INT,DWORD); + BOOL (CDECL *pPatBlt)(PHYSDEV,struct bitblt_coords*,DWORD); BOOL (CDECL *pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (CDECL *pPolyBezier)(PHYSDEV,const POINT*,DWORD); BOOL (CDECL *pPolyBezierTo)(PHYSDEV,const POINT*,DWORD); diff --git a/dlls/gdi32/mfdrv/bitblt.c b/dlls/gdi32/mfdrv/bitblt.c index 12529aa7911..3b6ed4e4b68 100644 --- a/dlls/gdi32/mfdrv/bitblt.c +++ b/dlls/gdi32/mfdrv/bitblt.c @@ -28,9 +28,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(metafile); /*********************************************************************** * MFDRV_PatBlt */ -BOOL CDECL MFDRV_PatBlt( PHYSDEV dev, INT left, INT top, INT width, INT height, DWORD rop ) +BOOL CDECL MFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) { - MFDRV_MetaParam6( dev, META_PATBLT, left, top, width, height, HIWORD(rop), LOWORD(rop) ); + MFDRV_MetaParam6( dev, META_PATBLT, dst->log_x, dst->log_y, dst->log_width, dst->log_height, + HIWORD(rop), LOWORD(rop) ); return TRUE; } diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h index 199a3929327..61d7ec20649 100644 --- a/dlls/gdi32/mfdrv/metafiledrv.h +++ b/dlls/gdi32/mfdrv/metafiledrv.h @@ -91,8 +91,7 @@ extern INT CDECL MFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC_HID extern BOOL CDECL MFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN; -extern BOOL CDECL MFDRV_PatBlt( PHYSDEV dev, INT left, INT top, INT width, INT height, - DWORD rop ) DECLSPEC_HIDDEN; +extern BOOL CDECL MFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; diff --git a/dlls/wineps.drv/bitblt.c b/dlls/wineps.drv/bitblt.c index f6a79f7a100..710b1b8a828 100644 --- a/dlls/wineps.drv/bitblt.c +++ b/dlls/wineps.drv/bitblt.c @@ -28,21 +28,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); * * PSDRV_PatBlt */ -BOOL CDECL PSDRV_PatBlt(PHYSDEV dev, INT x, INT y, INT width, INT height, DWORD dwRop) +BOOL CDECL PSDRV_PatBlt(PHYSDEV dev, struct bitblt_coords *dst, DWORD dwRop) { - POINT pt[2]; - - pt[0].x = x; - pt[0].y = y; - pt[1].x = x + width; - pt[1].y = y + height; - LPtoDP( dev->hdc, pt, 2 ); - switch(dwRop) { case PATCOPY: PSDRV_SetClip(dev); PSDRV_WriteGSave(dev); - PSDRV_WriteRectangle(dev, pt[0].x, pt[0].y, pt[1].x - pt[0].x, pt[1].y - pt[0].y ); + PSDRV_WriteRectangle(dev, dst->visrect.left, dst->visrect.top, + dst->visrect.right - dst->visrect.left, + dst->visrect.bottom - dst->visrect.top ); PSDRV_Brush(dev, FALSE); PSDRV_WriteGRestore(dev); PSDRV_ResetClip(dev); @@ -55,7 +49,9 @@ BOOL CDECL PSDRV_PatBlt(PHYSDEV dev, INT x, INT y, INT width, INT height, DWORD PSDRV_SetClip(dev); PSDRV_WriteGSave(dev); - PSDRV_WriteRectangle(dev, pt[0].x, pt[0].y, pt[1].x - pt[0].x, pt[1].y - pt[0].y ); + PSDRV_WriteRectangle(dev, dst->visrect.left, dst->visrect.top, + dst->visrect.right - dst->visrect.left, + dst->visrect.bottom - dst->visrect.top ); PSDRV_CreateColor( dev, &pscol, (dwRop == BLACKNESS) ? RGB(0,0,0) : RGB(0xff,0xff,0xff) ); PSDRV_WriteSetColor(dev, &pscol); PSDRV_WriteFill(dev); @@ -64,7 +60,7 @@ BOOL CDECL PSDRV_PatBlt(PHYSDEV dev, INT x, INT y, INT width, INT height, DWORD return TRUE; } default: - FIXME("Unsupported rop %d\n", dwRop); + FIXME("Unsupported rop %06x\n", dwRop); return FALSE; } } diff --git a/dlls/wineps.drv/wineps.drv.spec b/dlls/wineps.drv/wineps.drv.spec index e82f5500939..1a8277829dc 100644 --- a/dlls/wineps.drv/wineps.drv.spec +++ b/dlls/wineps.drv/wineps.drv.spec @@ -18,7 +18,7 @@ @ cdecl GetTextMetrics(ptr ptr) PSDRV_GetTextMetrics @ cdecl LineTo(ptr long long) PSDRV_LineTo @ cdecl PaintRgn(ptr long) PSDRV_PaintRgn -@ cdecl PatBlt(ptr long long long long long) PSDRV_PatBlt +@ cdecl PatBlt(ptr ptr long) PSDRV_PatBlt @ cdecl Pie(ptr long long long long long long long long) PSDRV_Pie @ cdecl PolyPolygon(ptr ptr ptr long) PSDRV_PolyPolygon @ cdecl PolyPolyline(ptr ptr ptr long) PSDRV_PolyPolyline diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 0a618bbade7..71fd11abaef 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1408,35 +1408,15 @@ static BOOL same_format(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst) /*********************************************************************** * X11DRV_PatBlt */ -BOOL CDECL X11DRV_PatBlt( PHYSDEV dev, INT x, INT y, INT width, INT height, DWORD rop ) +BOOL CDECL X11DRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) { X11DRV_PDEVICE *physDev = get_x11drv_dev( dev ); BOOL usePat = (((rop >> 4) & 0x0f0000) != (rop & 0x0f0000)); const BYTE *opcode = BITBLT_Opcodes[(rop >> 16) & 0xff]; - struct bitblt_coords dst; - dst.x = x; - dst.y = y; - dst.width = width; - dst.height = height; - dst.layout = GetLayout( dev->hdc ); - - if (rop & NOMIRRORBITMAP) - { - dst.layout |= LAYOUT_BITMAPORIENTATIONPRESERVED; - rop &= ~NOMIRRORBITMAP; - } - - if (!BITBLT_GetVisRectangles( physDev, NULL, &dst, NULL )) return TRUE; + if (IsRectEmpty( &dst->visrect )) return TRUE; if (usePat && !X11DRV_SetupGCForBrush( physDev )) return TRUE; - TRACE( "rect=%d,%d %dx%d org=%d,%d vis=%s\n", - dst.x, dst.y, dst.width, dst.height, - physDev->dc_rect.left, physDev->dc_rect.top, wine_dbgstr_rect( &dst.visrect ) ); - - width = dst.visrect.right - dst.visrect.left; - height = dst.visrect.bottom - dst.visrect.top; - X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod ); wine_tsx11_lock(); @@ -1472,10 +1452,10 @@ BOOL CDECL X11DRV_PatBlt( PHYSDEV dev, INT x, INT y, INT width, INT height, DWOR break; } XFillRectangle( gdi_display, physDev->drawable, physDev->gc, - physDev->dc_rect.left + dst.visrect.left, - physDev->dc_rect.top + dst.visrect.top, - dst.visrect.right - dst.visrect.left, - dst.visrect.bottom - dst.visrect.top ); + physDev->dc_rect.left + dst->visrect.left, + physDev->dc_rect.top + dst->visrect.top, + dst->visrect.right - dst->visrect.left, + dst->visrect.bottom - dst->visrect.top ); wine_tsx11_unlock(); X11DRV_UnlockDIBSection( physDev, TRUE ); diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index e4ca62b80c9..07c6ec7a07a 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -30,7 +30,7 @@ @ cdecl GetTextMetrics(ptr ptr) X11DRV_GetTextMetrics @ cdecl LineTo(ptr long long) X11DRV_LineTo @ cdecl PaintRgn(ptr long) X11DRV_PaintRgn -@ cdecl PatBlt(ptr long long long long long) X11DRV_PatBlt +@ cdecl PatBlt(ptr ptr long) X11DRV_PatBlt @ cdecl Pie(ptr long long long long long long long long) X11DRV_Pie @ cdecl PolyPolygon(ptr ptr ptr long) X11DRV_PolyPolygon @ cdecl PolyPolyline(ptr ptr ptr long) X11DRV_PolyPolyline