gdi32: Pass the dest visible rectangle to the PatBlt driver entry point.

This commit is contained in:
Alexandre Julliard 2011-07-11 13:59:05 +02:00
parent 8bd130b923
commit 1ac1d7c69b
13 changed files with 61 additions and 70 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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

View File

@ -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 );

View File

@ -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