From 3a850fc842337640b4b69634a4c6291d516d1192 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 9 Mar 2011 16:21:45 +0100 Subject: [PATCH] gdi32: Add null driver entry points for the mapping functions. --- dlls/gdi32/driver.c | 34 +- dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 20 +- dlls/gdi32/enhmfdrv/init.c | 16 +- dlls/gdi32/enhmfdrv/mapping.c | 68 ++-- dlls/gdi32/gdi_private.h | 25 +- dlls/gdi32/mapping.c | 525 ++++++++++++++------------- dlls/gdi32/mfdrv/init.c | 16 +- dlls/gdi32/mfdrv/mapping.c | 68 ++-- dlls/gdi32/mfdrv/metafiledrv.h | 20 +- dlls/gdi32/tests/metafile.c | 16 +- 10 files changed, 411 insertions(+), 397 deletions(-) diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index d88f60b69f9..80c327ac3e1 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -126,8 +126,8 @@ static struct graphics_driver *create_driver( HMODULE module ) GET_FUNC(MoveTo); GET_FUNC(ModifyWorldTransform); GET_FUNC(OffsetClipRgn); - GET_FUNC(OffsetViewportOrg); - GET_FUNC(OffsetWindowOrg); + GET_FUNC(OffsetViewportOrgEx); + GET_FUNC(OffsetWindowOrgEx); GET_FUNC(PaintRgn); GET_FUNC(PatBlt); GET_FUNC(Pie); @@ -146,8 +146,8 @@ static struct graphics_driver *create_driver( HMODULE module ) GET_FUNC(RestoreDC); GET_FUNC(RoundRect); GET_FUNC(SaveDC); - GET_FUNC(ScaleViewportExt); - GET_FUNC(ScaleWindowExt); + GET_FUNC(ScaleViewportExtEx); + GET_FUNC(ScaleWindowExtEx); GET_FUNC(SelectBitmap); GET_FUNC(SelectBrush); GET_FUNC(SelectClipPath); @@ -177,10 +177,10 @@ static struct graphics_driver *create_driver( HMODULE module ) GET_FUNC(SetTextCharacterExtra); GET_FUNC(SetTextColor); GET_FUNC(SetTextJustification); - GET_FUNC(SetViewportExt); - GET_FUNC(SetViewportOrg); - GET_FUNC(SetWindowExt); - GET_FUNC(SetWindowOrg); + GET_FUNC(SetViewportExtEx); + GET_FUNC(SetViewportOrgEx); + GET_FUNC(SetWindowExtEx); + GET_FUNC(SetWindowOrgEx); GET_FUNC(SetWorldTransform); GET_FUNC(StartDoc); GET_FUNC(StartPage); @@ -483,8 +483,8 @@ const DC_FUNCTIONS null_driver = NULL, /* pModifyWorldTransform */ nulldrv_MoveTo, /* pMoveTo */ nulldrv_OffsetClipRgn, /* pOffsetClipRgn */ - NULL, /* pOffsetViewportOrg */ - NULL, /* pOffsetWindowOrg */ + nulldrv_OffsetViewportOrgEx, /* pOffsetViewportOrg */ + nulldrv_OffsetWindowOrgEx, /* pOffsetWindowOrg */ nulldrv_PaintRgn, /* pPaintRgn */ NULL, /* pPatBlt */ nulldrv_Pie, /* pPie */ @@ -503,8 +503,8 @@ const DC_FUNCTIONS null_driver = NULL, /* pRestoreDC */ nulldrv_RoundRect, /* pRoundRect */ NULL, /* pSaveDC */ - NULL, /* pScaleViewportExt */ - NULL, /* pScaleWindowExt */ + nulldrv_ScaleViewportExtEx, /* pScaleViewportExt */ + nulldrv_ScaleWindowExtEx, /* pScaleWindowExt */ NULL, /* pSelectBitmap */ NULL, /* pSelectBrush */ NULL, /* pSelectClipPath */ @@ -522,7 +522,7 @@ const DC_FUNCTIONS null_driver = NULL, /* pSetDIBitsToDevice */ nulldrv_SetDeviceClipping, /* pSetDeviceClipping */ NULL, /* pSetDeviceGammaRamp */ - NULL, /* pSetMapMode */ + nulldrv_SetMapMode, /* pSetMapMode */ NULL, /* pSetMapperFlags */ nulldrv_SetPixel, /* pSetPixel */ NULL, /* pSetPixelFormat */ @@ -534,10 +534,10 @@ const DC_FUNCTIONS null_driver = NULL, /* pSetTextCharacterExtra */ NULL, /* pSetTextColor */ NULL, /* pSetTextJustification */ - NULL, /* pSetViewportExt */ - NULL, /* pSetViewportOrg */ - NULL, /* pSetWindowExt */ - NULL, /* pSetWindowOrg */ + nulldrv_SetViewportExtEx, /* pSetViewportExt */ + nulldrv_SetViewportOrgEx, /* pSetViewportOrg */ + nulldrv_SetWindowExtEx, /* pSetWindowExt */ + nulldrv_SetWindowOrgEx, /* pSetWindowOrg */ NULL, /* pSetWorldTransform */ nulldrv_StartDoc, /* pStartDoc */ nulldrv_StartPage, /* pStartPage */ diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h index 7a332373e35..48645fcd90c 100644 --- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h +++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h @@ -94,8 +94,8 @@ extern BOOL CDECL EMFDRV_LineTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN extern BOOL CDECL EMFDRV_ModifyWorldTransform( PHYSDEV dev, const XFORM *xform, DWORD mode ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_MoveTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; extern INT CDECL EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL EMFDRV_OffsetViewportOrg( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL EMFDRV_OffsetWindowOrg( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; +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; @@ -115,10 +115,10 @@ extern BOOL CDECL EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) DECLSPEC_HIDDEN; extern INT CDECL EMFDRV_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN; -extern INT CDECL EMFDRV_ScaleViewportExt( PHYSDEV dev, INT xNum, - INT xDenom, INT yNum, INT yDenom ) DECLSPEC_HIDDEN; -extern INT CDECL EMFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, - INT yNum, INT yDenom ) DECLSPEC_HIDDEN; +extern BOOL CDECL EMFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, + INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; +extern BOOL CDECL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, + INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; extern HBITMAP CDECL EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN; extern HBRUSH CDECL EMFDRV_SelectBrush( PHYSDEV dev, HBRUSH handle ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode ) DECLSPEC_HIDDEN; @@ -143,10 +143,10 @@ extern UINT CDECL EMFDRV_SetTextAlign( PHYSDEV dev, UINT align ) DECLSPEC_HI extern COLORREF CDECL EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_SetTextJustification( PHYSDEV dev, INT nBreakExtra, INT nBreakCount ) DECLSPEC_HIDDEN; -extern INT CDECL EMFDRV_SetViewportExt( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL EMFDRV_SetViewportOrg( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL EMFDRV_SetWindowExt( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL EMFDRV_SetWindowOrg( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; +extern BOOL CDECL EMFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN; +extern BOOL CDECL EMFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; +extern BOOL CDECL EMFDRV_SetWindowExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN; +extern BOOL CDECL EMFDRV_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_SetWorldTransform( PHYSDEV dev, const XFORM *xform ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst, INT heightDst, diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c index 241bd7e4a59..80b0c70d62a 100644 --- a/dlls/gdi32/enhmfdrv/init.c +++ b/dlls/gdi32/enhmfdrv/init.c @@ -88,8 +88,8 @@ static const DC_FUNCTIONS EMFDRV_Funcs = EMFDRV_ModifyWorldTransform, /* pModifyWorldTransform */ EMFDRV_MoveTo, /* pMoveTo */ EMFDRV_OffsetClipRgn, /* pOffsetClipRgn */ - EMFDRV_OffsetViewportOrg, /* pOffsetViewportOrg */ - EMFDRV_OffsetWindowOrg, /* pOffsetWindowOrg */ + EMFDRV_OffsetViewportOrgEx, /* pOffsetViewportOrgEx */ + EMFDRV_OffsetWindowOrgEx, /* pOffsetWindowOrgEx */ EMFDRV_PaintRgn, /* pPaintRgn */ EMFDRV_PatBlt, /* pPatBlt */ EMFDRV_Pie, /* pPie */ @@ -108,8 +108,8 @@ static const DC_FUNCTIONS EMFDRV_Funcs = EMFDRV_RestoreDC, /* pRestoreDC */ EMFDRV_RoundRect, /* pRoundRect */ EMFDRV_SaveDC, /* pSaveDC */ - EMFDRV_ScaleViewportExt, /* pScaleViewportExt */ - EMFDRV_ScaleWindowExt, /* pScaleWindowExt */ + EMFDRV_ScaleViewportExtEx, /* pScaleViewportExtEx */ + EMFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */ EMFDRV_SelectBitmap, /* pSelectBitmap */ EMFDRV_SelectBrush, /* pSelectBrush */ EMFDRV_SelectClipPath, /* pSelectClipPath */ @@ -139,10 +139,10 @@ static const DC_FUNCTIONS EMFDRV_Funcs = NULL, /* pSetTextCharacterExtra */ EMFDRV_SetTextColor, /* pSetTextColor */ EMFDRV_SetTextJustification, /* pSetTextJustification */ - EMFDRV_SetViewportExt, /* pSetViewportExt */ - EMFDRV_SetViewportOrg, /* pSetViewportOrg */ - EMFDRV_SetWindowExt, /* pSetWindowExt */ - EMFDRV_SetWindowOrg, /* pSetWindowOrg */ + EMFDRV_SetViewportExtEx, /* pSetViewportExtEx */ + EMFDRV_SetViewportOrgEx, /* pSetViewportOrgEx */ + EMFDRV_SetWindowExtEx, /* pSetWindowExtEx */ + EMFDRV_SetWindowOrgEx, /* pSetWindowOrgEx */ EMFDRV_SetWorldTransform, /* pSetWorldTransform */ NULL, /* pStartDoc */ NULL, /* pStartPage */ diff --git a/dlls/gdi32/enhmfdrv/mapping.c b/dlls/gdi32/enhmfdrv/mapping.c index 5e3e9718809..b89ed206d40 100644 --- a/dlls/gdi32/enhmfdrv/mapping.c +++ b/dlls/gdi32/enhmfdrv/mapping.c @@ -22,16 +22,19 @@ INT CDECL EMFDRV_SetMapMode( PHYSDEV dev, INT mode ) { + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetMapMode ); EMRSETMAPMODE emr; emr.emr.iType = EMR_SETMAPMODE; emr.emr.nSize = sizeof(emr); emr.iMode = mode; - return EMFDRV_WriteRecord( dev, &emr.emr ); + if (!EMFDRV_WriteRecord( dev, &emr.emr )) return 0; + return next->funcs->pSetMapMode( next, mode ); } -INT CDECL EMFDRV_SetViewportExt( PHYSDEV dev, INT cx, INT cy ) +BOOL CDECL EMFDRV_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) { + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetViewportExtEx ); EMRSETVIEWPORTEXTEX emr; emr.emr.iType = EMR_SETVIEWPORTEXTEX; @@ -39,11 +42,13 @@ INT CDECL EMFDRV_SetViewportExt( PHYSDEV dev, INT cx, INT cy ) emr.szlExtent.cx = cx; emr.szlExtent.cy = cy; - return EMFDRV_WriteRecord( dev, &emr.emr ); + if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE; + return next->funcs->pSetViewportExtEx( next, cx, cy, size ); } -INT CDECL EMFDRV_SetWindowExt( PHYSDEV dev, INT cx, INT cy ) +BOOL CDECL EMFDRV_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) { + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetWindowExtEx ); EMRSETWINDOWEXTEX emr; emr.emr.iType = EMR_SETWINDOWEXTEX; @@ -51,11 +56,13 @@ INT CDECL EMFDRV_SetWindowExt( PHYSDEV dev, INT cx, INT cy ) emr.szlExtent.cx = cx; emr.szlExtent.cy = cy; - return EMFDRV_WriteRecord( dev, &emr.emr ); + if (!EMFDRV_WriteRecord( dev, &emr.emr )) return 0; + return next->funcs->pSetWindowExtEx( next, cx, cy, size ); } -INT CDECL EMFDRV_SetViewportOrg( PHYSDEV dev, INT x, INT y ) +BOOL CDECL EMFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) { + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetViewportOrgEx ); EMRSETVIEWPORTORGEX emr; emr.emr.iType = EMR_SETVIEWPORTORGEX; @@ -63,11 +70,13 @@ INT CDECL EMFDRV_SetViewportOrg( PHYSDEV dev, INT x, INT y ) emr.ptlOrigin.x = x; emr.ptlOrigin.y = y; - return EMFDRV_WriteRecord( dev, &emr.emr ); + if (!EMFDRV_WriteRecord( dev, &emr.emr )) return 0; + return next->funcs->pSetViewportOrgEx( next, x, y, pt ); } -INT CDECL EMFDRV_SetWindowOrg( PHYSDEV dev, INT x, INT y ) +BOOL CDECL EMFDRV_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) { + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetWindowOrgEx ); EMRSETWINDOWORGEX emr; emr.emr.iType = EMR_SETWINDOWORGEX; @@ -75,12 +84,13 @@ INT CDECL EMFDRV_SetWindowOrg( PHYSDEV dev, INT x, INT y ) emr.ptlOrigin.x = x; emr.ptlOrigin.y = y; - return EMFDRV_WriteRecord( dev, &emr.emr ); + if (!EMFDRV_WriteRecord( dev, &emr.emr )) return 0; + return next->funcs->pSetWindowOrgEx( next, x, y, pt ); } -INT CDECL EMFDRV_ScaleViewportExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, - INT yDenom ) +BOOL CDECL EMFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) { + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pScaleViewportExtEx ); EMRSCALEVIEWPORTEXTEX emr; emr.emr.iType = EMR_SCALEVIEWPORTEXTEX; @@ -90,12 +100,13 @@ INT CDECL EMFDRV_ScaleViewportExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, emr.yNum = yNum; emr.yDenom = yDenom; - return EMFDRV_WriteRecord( dev, &emr.emr ); + if (!EMFDRV_WriteRecord( dev, &emr.emr )) return 0; + return next->funcs->pScaleViewportExtEx( next, xNum, xDenom, yNum, yDenom, size ); } -INT CDECL EMFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, - INT yDenom ) +BOOL CDECL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) { + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pScaleWindowExtEx ); EMRSCALEWINDOWEXTEX emr; emr.emr.iType = EMR_SCALEWINDOWEXTEX; @@ -105,7 +116,8 @@ INT CDECL EMFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, emr.yNum = yNum; emr.yDenom = yDenom; - return EMFDRV_WriteRecord( dev, &emr.emr ); + if (!EMFDRV_WriteRecord( dev, &emr.emr )) return 0; + return next->funcs->pScaleWindowExtEx( next, xNum, xDenom, yNum, yDenom, size ); } BOOL CDECL EMFDRV_SetWorldTransform( PHYSDEV dev, const XFORM *xform) @@ -131,34 +143,36 @@ BOOL CDECL EMFDRV_ModifyWorldTransform( PHYSDEV dev, const XFORM *xform, DWORD m return EMFDRV_WriteRecord( dev, &emr.emr ); } -INT CDECL EMFDRV_OffsetViewportOrg( PHYSDEV dev, INT x, INT y ) +BOOL CDECL EMFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) { - POINT pt; + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pOffsetViewportOrgEx ); EMRSETVIEWPORTORGEX emr; EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev; - GetViewportOrgEx(physDev->hdc, &pt); + GetViewportOrgEx(physDev->hdc, pt); emr.emr.iType = EMR_SETVIEWPORTORGEX; emr.emr.nSize = sizeof(emr); - emr.ptlOrigin.x = pt.x + x; - emr.ptlOrigin.y = pt.y + y; + emr.ptlOrigin.x = pt->x + x; + emr.ptlOrigin.y = pt->y + y; - return EMFDRV_WriteRecord( dev, &emr.emr ); + if (!EMFDRV_WriteRecord( dev, &emr.emr )) return 0; + return next->funcs->pOffsetViewportOrgEx( next, x, y, pt ); } -INT CDECL EMFDRV_OffsetWindowOrg( PHYSDEV dev, INT x, INT y ) +BOOL CDECL EMFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) { - POINT pt; + PHYSDEV next = GET_NEXT_PHYSDEV( dev, pOffsetWindowOrgEx ); EMRSETWINDOWORGEX emr; EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev; - GetWindowOrgEx(physDev->hdc, &pt); + GetWindowOrgEx(physDev->hdc, pt); emr.emr.iType = EMR_SETWINDOWORGEX; emr.emr.nSize = sizeof(emr); - emr.ptlOrigin.x = pt.x + x; - emr.ptlOrigin.y = pt.y + y; + emr.ptlOrigin.x = pt->x + x; + emr.ptlOrigin.y = pt->y + y; - return EMFDRV_WriteRecord( dev, &emr.emr ); + if (!EMFDRV_WriteRecord( dev, &emr.emr )) return 0; + return next->funcs->pOffsetWindowOrgEx( next, x, y, pt ); } diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 7b72c45c710..0e3353cb43f 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -135,8 +135,8 @@ typedef struct tagDC_FUNCS BOOL (CDECL *pModifyWorldTransform)(PHYSDEV,const XFORM*,DWORD); BOOL (CDECL *pMoveTo)(PHYSDEV,INT,INT); INT (CDECL *pOffsetClipRgn)(PHYSDEV,INT,INT); - INT (CDECL *pOffsetViewportOrg)(PHYSDEV,INT,INT); - INT (CDECL *pOffsetWindowOrg)(PHYSDEV,INT,INT); + 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 *pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT); @@ -155,8 +155,8 @@ typedef struct tagDC_FUNCS BOOL (CDECL *pRestoreDC)(PHYSDEV,INT); BOOL (CDECL *pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT); INT (CDECL *pSaveDC)(PHYSDEV); - INT (CDECL *pScaleViewportExt)(PHYSDEV,INT,INT,INT,INT); - INT (CDECL *pScaleWindowExt)(PHYSDEV,INT,INT,INT,INT); + BOOL (CDECL *pScaleViewportExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*); + BOOL (CDECL *pScaleWindowExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*); HBITMAP (CDECL *pSelectBitmap)(PHYSDEV,HBITMAP); HBRUSH (CDECL *pSelectBrush)(PHYSDEV,HBRUSH); BOOL (CDECL *pSelectClipPath)(PHYSDEV,INT); @@ -187,10 +187,10 @@ typedef struct tagDC_FUNCS INT (CDECL *pSetTextCharacterExtra)(PHYSDEV,INT); DWORD (CDECL *pSetTextColor)(PHYSDEV,DWORD); INT (CDECL *pSetTextJustification)(PHYSDEV,INT,INT); - INT (CDECL *pSetViewportExt)(PHYSDEV,INT,INT); - INT (CDECL *pSetViewportOrg)(PHYSDEV,INT,INT); - INT (CDECL *pSetWindowExt)(PHYSDEV,INT,INT); - INT (CDECL *pSetWindowOrg)(PHYSDEV,INT,INT); + BOOL (CDECL *pSetViewportExtEx)(PHYSDEV,INT,INT,SIZE*); + BOOL (CDECL *pSetViewportOrgEx)(PHYSDEV,INT,INT,POINT*); + BOOL (CDECL *pSetWindowExtEx)(PHYSDEV,INT,INT,SIZE*); + BOOL (CDECL *pSetWindowOrgEx)(PHYSDEV,INT,INT,POINT*); BOOL (CDECL *pSetWorldTransform)(PHYSDEV,const XFORM*); INT (CDECL *pStartDoc)(PHYSDEV,const DOCINFOW*); INT (CDECL *pStartPage)(PHYSDEV); @@ -521,10 +521,19 @@ extern BOOL CDECL nulldrv_FrameRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush, INT wid extern INT CDECL nulldrv_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_InvertRgn( PHYSDEV dev, HRGN rgn ) DECLSPEC_HIDDEN; extern INT CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; +extern BOOL CDECL nulldrv_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; +extern BOOL CDECL nulldrv_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_PolyBezier( PHYSDEV dev, const POINT *points, DWORD count ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types, DWORD count ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count ) DECLSPEC_HIDDEN; +extern BOOL CDECL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN; +extern BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN; +extern INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN; +extern BOOL CDECL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) DECLSPEC_HIDDEN; +extern BOOL CDECL nulldrv_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; +extern BOOL CDECL nulldrv_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) DECLSPEC_HIDDEN; +extern BOOL CDECL nulldrv_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; static inline DC *get_nulldrv_dc( PHYSDEV dev ) { diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c index 667c83b8ecc..4a18dafe99c 100644 --- a/dlls/gdi32/mapping.c +++ b/dlls/gdi32/mapping.c @@ -56,6 +56,215 @@ static void MAPPING_FixIsotropic( DC * dc ) } +/*********************************************************************** + * null driver fallback implementations + */ + +BOOL CDECL nulldrv_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) +{ + DC *dc = get_nulldrv_dc( dev ); + + if (pt) + { + pt->x = dc->vportOrgX; + pt->y = dc->vportOrgY; + } + dc->vportOrgX += x; + dc->vportOrgY += y; + DC_UpdateXforms( dc ); + return TRUE; +} + +BOOL CDECL nulldrv_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) +{ + DC *dc = get_nulldrv_dc( dev ); + + if (pt) + { + pt->x = dc->wndOrgX; + pt->y = dc->wndOrgY; + } + dc->wndOrgX += x; + dc->wndOrgY += y; + DC_UpdateXforms( dc ); + return TRUE; +} + +BOOL CDECL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, + SIZE *size ) +{ + DC *dc = get_nulldrv_dc( dev ); + + if (size) + { + size->cx = dc->vportExtX; + size->cy = dc->vportExtY; + } + if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE; + if (!x_num || !x_denom || !y_num || !y_denom) return FALSE; + + dc->vportExtX = (dc->vportExtX * x_num) / x_denom; + dc->vportExtY = (dc->vportExtY * y_num) / y_denom; + if (dc->vportExtX == 0) dc->vportExtX = 1; + if (dc->vportExtY == 0) dc->vportExtY = 1; + if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); + DC_UpdateXforms( dc ); + return TRUE; +} + +BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, + SIZE *size ) +{ + DC *dc = get_nulldrv_dc( dev ); + + if (size) + { + size->cx = dc->wndExtX; + size->cy = dc->wndExtY; + } + if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE; + if (!x_num || !x_denom || !y_num || !y_denom) return FALSE; + + dc->wndExtX = (dc->wndExtX * x_num) / x_denom; + dc->wndExtY = (dc->wndExtY * y_num) / y_denom; + if (dc->wndExtX == 0) dc->wndExtX = 1; + if (dc->wndExtY == 0) dc->wndExtY = 1; + if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); + DC_UpdateXforms( dc ); + return TRUE; +} + +INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode ) +{ + DC *dc = get_nulldrv_dc( dev ); + INT ret = dc->MapMode; + INT horzSize, vertSize, horzRes, vertRes; + + if (mode == dc->MapMode && (mode == MM_ISOTROPIC || mode == MM_ANISOTROPIC)) return ret; + + horzSize = dc->virtual_size.cx; + vertSize = dc->virtual_size.cy; + horzRes = dc->virtual_res.cx; + vertRes = dc->virtual_res.cy; + switch (mode) + { + case MM_TEXT: + dc->wndExtX = 1; + dc->wndExtY = 1; + dc->vportExtX = 1; + dc->vportExtY = 1; + break; + case MM_LOMETRIC: + case MM_ISOTROPIC: + dc->wndExtX = horzSize * 10; + dc->wndExtY = vertSize * 10; + dc->vportExtX = horzRes; + dc->vportExtY = -vertRes; + break; + case MM_HIMETRIC: + dc->wndExtX = horzSize * 100; + dc->wndExtY = vertSize * 100; + dc->vportExtX = horzRes; + dc->vportExtY = -vertRes; + break; + case MM_LOENGLISH: + dc->wndExtX = MulDiv(1000, horzSize, 254); + dc->wndExtY = MulDiv(1000, vertSize, 254); + dc->vportExtX = horzRes; + dc->vportExtY = -vertRes; + break; + case MM_HIENGLISH: + dc->wndExtX = MulDiv(10000, horzSize, 254); + dc->wndExtY = MulDiv(10000, vertSize, 254); + dc->vportExtX = horzRes; + dc->vportExtY = -vertRes; + break; + case MM_TWIPS: + dc->wndExtX = MulDiv(14400, horzSize, 254); + dc->wndExtY = MulDiv(14400, vertSize, 254); + dc->vportExtX = horzRes; + dc->vportExtY = -vertRes; + break; + case MM_ANISOTROPIC: + break; + default: + return 0; + } + /* RTL layout is always MM_ANISOTROPIC */ + if (!(dc->layout & LAYOUT_RTL)) dc->MapMode = mode; + DC_UpdateXforms( dc ); + return ret; +} + +BOOL CDECL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) +{ + DC *dc = get_nulldrv_dc( dev ); + + if (size) + { + size->cx = dc->vportExtX; + size->cy = dc->vportExtY; + } + if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE; + if (!cx || !cy) return FALSE; + dc->vportExtX = cx; + dc->vportExtY = cy; + if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); + DC_UpdateXforms( dc ); + return TRUE; +} + +BOOL CDECL nulldrv_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) +{ + DC *dc = get_nulldrv_dc( dev ); + + if (pt) + { + pt->x = dc->vportOrgX; + pt->y = dc->vportOrgY; + } + dc->vportOrgX = x; + dc->vportOrgY = y; + DC_UpdateXforms( dc ); + return TRUE; +} + +BOOL CDECL nulldrv_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) +{ + DC *dc = get_nulldrv_dc( dev ); + + if (size) + { + size->cx = dc->wndExtX; + size->cy = dc->wndExtY; + } + if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE; + if (!cx || !cy) return FALSE; + dc->wndExtX = cx; + dc->wndExtY = cy; + /* The API docs say that you should call SetWindowExtEx before + SetViewportExtEx. This advice does not imply that Windows + doesn't ensure the isotropic mapping after SetWindowExtEx! */ + if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); + DC_UpdateXforms( dc ); + return TRUE; +} + +BOOL CDECL nulldrv_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) +{ + DC *dc = get_nulldrv_dc( dev ); + + if (pt) + { + pt->x = dc->wndOrgX; + pt->y = dc->wndOrgY; + } + dc->wndOrgX = x; + dc->wndOrgY = y; + DC_UpdateXforms( dc ); + return TRUE; +} + /*********************************************************************** * DPtoLP (GDI32.@) */ @@ -114,81 +323,17 @@ BOOL WINAPI LPtoDP( HDC hdc, LPPOINT points, INT count ) */ INT WINAPI SetMapMode( HDC hdc, INT mode ) { - INT ret; - INT horzSize, vertSize, horzRes, vertRes; - + INT ret = 0; DC * dc = get_dc_ptr( hdc ); - if (!dc) return 0; - if (dc->funcs->pSetMapMode) - { - if((ret = dc->funcs->pSetMapMode( dc->physDev, mode )) != TRUE) - { - if(ret == GDI_NO_MORE_WORK) - ret = TRUE; - goto done; - } - } TRACE("%p %d\n", hdc, mode ); - ret = dc->MapMode; - - if (mode == dc->MapMode && (mode == MM_ISOTROPIC || mode == MM_ANISOTROPIC)) - goto done; - - horzSize = dc->virtual_size.cx; - vertSize = dc->virtual_size.cy; - horzRes = dc->virtual_res.cx; - vertRes = dc->virtual_res.cy; - switch(mode) + if (dc) { - case MM_TEXT: - dc->wndExtX = 1; - dc->wndExtY = 1; - dc->vportExtX = 1; - dc->vportExtY = 1; - break; - case MM_LOMETRIC: - case MM_ISOTROPIC: - dc->wndExtX = horzSize * 10; - dc->wndExtY = vertSize * 10; - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; - break; - case MM_HIMETRIC: - dc->wndExtX = horzSize * 100; - dc->wndExtY = vertSize * 100; - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; - break; - case MM_LOENGLISH: - dc->wndExtX = MulDiv(1000, horzSize, 254); - dc->wndExtY = MulDiv(1000, vertSize, 254); - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; - break; - case MM_HIENGLISH: - dc->wndExtX = MulDiv(10000, horzSize, 254); - dc->wndExtY = MulDiv(10000, vertSize, 254); - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; - break; - case MM_TWIPS: - dc->wndExtX = MulDiv(14400, horzSize, 254); - dc->wndExtY = MulDiv(14400, vertSize, 254); - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; - break; - case MM_ANISOTROPIC: - break; - default: - goto done; + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetMapMode ); + ret = physdev->funcs->pSetMapMode( physdev, mode ); + release_dc_ptr( dc ); } - /* RTL layout is always MM_ANISOTROPIC */ - if (!(dc->layout & LAYOUT_RTL)) dc->MapMode = mode; - DC_UpdateXforms( dc ); - done: - release_dc_ptr( dc ); return ret; } @@ -198,36 +343,15 @@ INT WINAPI SetMapMode( HDC hdc, INT mode ) */ BOOL WINAPI SetViewportExtEx( HDC hdc, INT x, INT y, LPSIZE size ) { - INT ret = TRUE; + INT ret = FALSE; DC * dc = get_dc_ptr( hdc ); - if (!dc) return FALSE; - if (dc->funcs->pSetViewportExt) + + if (dc) { - if((ret = dc->funcs->pSetViewportExt( dc->physDev, x, y )) != TRUE) - { - if(ret == GDI_NO_MORE_WORK) - ret = TRUE; - goto done; - } + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetViewportExtEx ); + ret = physdev->funcs->pSetViewportExtEx( physdev, x, y, size ); + release_dc_ptr( dc ); } - if (size) - { - size->cx = dc->vportExtX; - size->cy = dc->vportExtY; - } - if ((dc->MapMode != MM_ISOTROPIC) && (dc->MapMode != MM_ANISOTROPIC)) - goto done; - if (!x || !y) - { - ret = FALSE; - goto done; - } - dc->vportExtX = x; - dc->vportExtY = y; - if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); - DC_UpdateXforms( dc ); - done: - release_dc_ptr( dc ); return ret; } @@ -237,29 +361,15 @@ BOOL WINAPI SetViewportExtEx( HDC hdc, INT x, INT y, LPSIZE size ) */ BOOL WINAPI SetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) { - INT ret = TRUE; + INT ret = FALSE; DC * dc = get_dc_ptr( hdc ); - if (!dc) return FALSE; - if (dc->funcs->pSetViewportOrg) - { - if((ret = dc->funcs->pSetViewportOrg( dc->physDev, x, y )) != TRUE) - { - if(ret == GDI_NO_MORE_WORK) - ret = TRUE; - goto done; - } - } - if (pt) - { - pt->x = dc->vportOrgX; - pt->y = dc->vportOrgY; - } - dc->vportOrgX = x; - dc->vportOrgY = y; - DC_UpdateXforms( dc ); - done: - release_dc_ptr( dc ); + if (dc) + { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetViewportOrgEx ); + ret = physdev->funcs->pSetViewportOrgEx( physdev, x, y, pt ); + release_dc_ptr( dc ); + } return ret; } @@ -269,39 +379,15 @@ BOOL WINAPI SetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) */ BOOL WINAPI SetWindowExtEx( HDC hdc, INT x, INT y, LPSIZE size ) { - INT ret = TRUE; + INT ret = FALSE; DC * dc = get_dc_ptr( hdc ); - if (!dc) return FALSE; - if (dc->funcs->pSetWindowExt) + + if (dc) { - if((ret = dc->funcs->pSetWindowExt( dc->physDev, x, y )) != TRUE) - { - if(ret == GDI_NO_MORE_WORK) - ret = TRUE; - goto done; - } + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetWindowExtEx ); + ret = physdev->funcs->pSetWindowExtEx( physdev, x, y, size ); + release_dc_ptr( dc ); } - if (size) - { - size->cx = dc->wndExtX; - size->cy = dc->wndExtY; - } - if ((dc->MapMode != MM_ISOTROPIC) && (dc->MapMode != MM_ANISOTROPIC)) - goto done; - if (!x || !y) - { - ret = FALSE; - goto done; - } - dc->wndExtX = x; - dc->wndExtY = y; - /* The API docs say that you should call SetWindowExtEx before - SetViewportExtEx. This advice does not imply that Windows - doesn't ensure the isotropic mapping after SetWindowExtEx! */ - if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); - DC_UpdateXforms( dc ); - done: - release_dc_ptr( dc ); return ret; } @@ -311,28 +397,15 @@ BOOL WINAPI SetWindowExtEx( HDC hdc, INT x, INT y, LPSIZE size ) */ BOOL WINAPI SetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) { - INT ret = TRUE; + INT ret = FALSE; DC * dc = get_dc_ptr( hdc ); - if (!dc) return FALSE; - if (dc->funcs->pSetWindowOrg) + + if (dc) { - if((ret = dc->funcs->pSetWindowOrg( dc->physDev, x, y )) != TRUE) - { - if(ret == GDI_NO_MORE_WORK) - ret = TRUE; - goto done; - } + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetWindowOrgEx ); + ret = physdev->funcs->pSetWindowOrgEx( physdev, x, y, pt ); + release_dc_ptr( dc ); } - if (pt) - { - pt->x = dc->wndOrgX; - pt->y = dc->wndOrgY; - } - dc->wndOrgX = x; - dc->wndOrgY = y; - DC_UpdateXforms( dc ); - done: - release_dc_ptr( dc ); return ret; } @@ -342,28 +415,15 @@ BOOL WINAPI SetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) */ BOOL WINAPI OffsetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt) { - INT ret = TRUE; + INT ret = FALSE; DC * dc = get_dc_ptr( hdc ); - if (!dc) return FALSE; - if (dc->funcs->pOffsetViewportOrg) + + if (dc) { - if((ret = dc->funcs->pOffsetViewportOrg( dc->physDev, x, y )) != TRUE) - { - if(ret == GDI_NO_MORE_WORK) - ret = TRUE; - goto done; - } + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pOffsetViewportOrgEx ); + ret = physdev->funcs->pOffsetViewportOrgEx( physdev, x, y, pt ); + release_dc_ptr( dc ); } - if (pt) - { - pt->x = dc->vportOrgX; - pt->y = dc->vportOrgY; - } - dc->vportOrgX += x; - dc->vportOrgY += y; - DC_UpdateXforms( dc ); - done: - release_dc_ptr( dc ); return ret; } @@ -373,28 +433,15 @@ BOOL WINAPI OffsetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt) */ BOOL WINAPI OffsetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) { - INT ret = TRUE; + INT ret = FALSE; DC * dc = get_dc_ptr( hdc ); - if (!dc) return FALSE; - if (dc->funcs->pOffsetWindowOrg) + + if (dc) { - if((ret = dc->funcs->pOffsetWindowOrg( dc->physDev, x, y )) != TRUE) - { - if(ret == GDI_NO_MORE_WORK) - ret = TRUE; - goto done; - } + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pOffsetWindowOrgEx ); + ret = physdev->funcs->pOffsetWindowOrgEx( physdev, x, y, pt ); + release_dc_ptr( dc ); } - if (pt) - { - pt->x = dc->wndOrgX; - pt->y = dc->wndOrgY; - } - dc->wndOrgX += x; - dc->wndOrgY += y; - DC_UpdateXforms( dc ); - done: - release_dc_ptr( dc ); return ret; } @@ -405,38 +452,15 @@ BOOL WINAPI OffsetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT xNum, INT xDenom, INT yNum, INT yDenom, LPSIZE size ) { - INT ret = TRUE; + INT ret = FALSE; DC * dc = get_dc_ptr( hdc ); - if (!dc) return FALSE; - if (dc->funcs->pScaleViewportExt) + + if (dc) { - if((ret = dc->funcs->pScaleViewportExt( dc->physDev, xNum, xDenom, yNum, yDenom )) != TRUE) - { - if(ret == GDI_NO_MORE_WORK) - ret = TRUE; - goto done; - } + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pScaleViewportExtEx ); + ret = physdev->funcs->pScaleViewportExtEx( physdev, xNum, xDenom, yNum, yDenom, size ); + release_dc_ptr( dc ); } - if (size) - { - size->cx = dc->vportExtX; - size->cy = dc->vportExtY; - } - if ((dc->MapMode != MM_ISOTROPIC) && (dc->MapMode != MM_ANISOTROPIC)) - goto done; - if (!xNum || !xDenom || !yNum || !yDenom) - { - ret = FALSE; - goto done; - } - dc->vportExtX = (dc->vportExtX * xNum) / xDenom; - dc->vportExtY = (dc->vportExtY * yNum) / yDenom; - if (dc->vportExtX == 0) dc->vportExtX = 1; - if (dc->vportExtY == 0) dc->vportExtY = 1; - if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); - DC_UpdateXforms( dc ); - done: - release_dc_ptr( dc ); return ret; } @@ -447,38 +471,15 @@ BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT xNum, INT xDenom, BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT xNum, INT xDenom, INT yNum, INT yDenom, LPSIZE size ) { - INT ret = TRUE; + INT ret = FALSE; DC * dc = get_dc_ptr( hdc ); - if (!dc) return FALSE; - if (dc->funcs->pScaleWindowExt) + + if (dc) { - if((ret = dc->funcs->pScaleWindowExt( dc->physDev, xNum, xDenom, yNum, yDenom )) != TRUE) - { - if(ret == GDI_NO_MORE_WORK) - ret = TRUE; - goto done; - } + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pScaleWindowExtEx ); + ret = physdev->funcs->pScaleWindowExtEx( physdev, xNum, xDenom, yNum, yDenom, size ); + release_dc_ptr( dc ); } - if (size) - { - size->cx = dc->wndExtX; - size->cy = dc->wndExtY; - } - if ((dc->MapMode != MM_ISOTROPIC) && (dc->MapMode != MM_ANISOTROPIC)) - goto done; - if (!xNum || !xDenom || !xNum || !yDenom) - { - ret = FALSE; - goto done; - } - dc->wndExtX = (dc->wndExtX * xNum) / xDenom; - dc->wndExtY = (dc->wndExtY * yNum) / yDenom; - if (dc->wndExtX == 0) dc->wndExtX = 1; - if (dc->wndExtY == 0) dc->wndExtY = 1; - if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); - DC_UpdateXforms( dc ); - done: - release_dc_ptr( dc ); return ret; } diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index 3bb815b4db5..5c8847b8e93 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -86,8 +86,8 @@ static const DC_FUNCTIONS MFDRV_Funcs = NULL, /* pModifyWorldTransform */ MFDRV_MoveTo, /* pMoveTo */ MFDRV_OffsetClipRgn, /* pOffsetClipRgn */ - MFDRV_OffsetViewportOrg, /* pOffsetViewportOrg */ - MFDRV_OffsetWindowOrg, /* pOffsetWindowOrg */ + MFDRV_OffsetViewportOrgEx, /* pOffsetViewportOrgEx */ + MFDRV_OffsetWindowOrgEx, /* pOffsetWindowOrgEx */ MFDRV_PaintRgn, /* pPaintRgn */ MFDRV_PatBlt, /* pPatBlt */ MFDRV_Pie, /* pPie */ @@ -106,8 +106,8 @@ static const DC_FUNCTIONS MFDRV_Funcs = MFDRV_RestoreDC, /* pRestoreDC */ MFDRV_RoundRect, /* pRoundRect */ MFDRV_SaveDC, /* pSaveDC */ - MFDRV_ScaleViewportExt, /* pScaleViewportExt */ - MFDRV_ScaleWindowExt, /* pScaleWindowExt */ + MFDRV_ScaleViewportExtEx, /* pScaleViewportExtEx */ + MFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */ MFDRV_SelectBitmap, /* pSelectBitmap */ MFDRV_SelectBrush, /* pSelectBrush */ MFDRV_SelectClipPath, /* pSelectClipPath */ @@ -137,10 +137,10 @@ static const DC_FUNCTIONS MFDRV_Funcs = MFDRV_SetTextCharacterExtra, /* pSetTextCharacterExtra */ MFDRV_SetTextColor, /* pSetTextColor */ MFDRV_SetTextJustification, /* pSetTextJustification */ - MFDRV_SetViewportExt, /* pSetViewportExt */ - MFDRV_SetViewportOrg, /* pSetViewportOrg */ - MFDRV_SetWindowExt, /* pSetWindowExt */ - MFDRV_SetWindowOrg, /* pSetWindowOrg */ + MFDRV_SetViewportExtEx, /* pSetViewportExtEx */ + MFDRV_SetViewportOrgEx, /* pSetViewportOrgEx */ + MFDRV_SetWindowExtEx, /* pSetWindowExtEx */ + MFDRV_SetWindowOrgEx, /* pSetWindowOrgEx */ NULL, /* pSetWorldTransform */ NULL, /* pStartDoc */ NULL, /* pStartPage */ diff --git a/dlls/gdi32/mfdrv/mapping.c b/dlls/gdi32/mfdrv/mapping.c index f306cc66599..0b88515ebe9 100644 --- a/dlls/gdi32/mfdrv/mapping.c +++ b/dlls/gdi32/mfdrv/mapping.c @@ -31,95 +31,77 @@ */ INT CDECL MFDRV_SetMapMode( PHYSDEV dev, INT mode ) { - if(!MFDRV_MetaParam1( dev, META_SETMAPMODE, mode )) - return FALSE; - return GDI_NO_MORE_WORK; + return MFDRV_MetaParam1( dev, META_SETMAPMODE, mode ); } /*********************************************************************** - * MFDRV_SetViewportExt + * MFDRV_SetViewportExtEx */ -INT CDECL MFDRV_SetViewportExt( PHYSDEV dev, INT x, INT y ) +BOOL CDECL MFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) { - if(!MFDRV_MetaParam2( dev, META_SETVIEWPORTEXT, x, y )) - return FALSE; - return GDI_NO_MORE_WORK; + return MFDRV_MetaParam2( dev, META_SETVIEWPORTEXT, x, y ); } /*********************************************************************** - * MFDRV_SetViewportOrg + * MFDRV_SetViewportOrgEx */ -INT CDECL MFDRV_SetViewportOrg( PHYSDEV dev, INT x, INT y ) +BOOL CDECL MFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) { - if(!MFDRV_MetaParam2( dev, META_SETVIEWPORTORG, x, y )) - return FALSE; - return GDI_NO_MORE_WORK; + return MFDRV_MetaParam2( dev, META_SETVIEWPORTORG, x, y ); } /*********************************************************************** - * MFDRV_SetWindowExt + * MFDRV_SetWindowExtEx */ -INT CDECL MFDRV_SetWindowExt( PHYSDEV dev, INT x, INT y ) +BOOL CDECL MFDRV_SetWindowExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) { - if(!MFDRV_MetaParam2( dev, META_SETWINDOWEXT, x, y )) - return FALSE; - return GDI_NO_MORE_WORK; + return MFDRV_MetaParam2( dev, META_SETWINDOWEXT, x, y ); } /*********************************************************************** - * MFDRV_SetWindowOrg + * MFDRV_SetWindowOrgEx */ -INT CDECL MFDRV_SetWindowOrg( PHYSDEV dev, INT x, INT y ) +BOOL CDECL MFDRV_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) { - if(!MFDRV_MetaParam2( dev, META_SETWINDOWORG, x, y )) - return FALSE; - return GDI_NO_MORE_WORK; + return MFDRV_MetaParam2( dev, META_SETWINDOWORG, x, y ); } /*********************************************************************** - * MFDRV_OffsetViewportOrg + * MFDRV_OffsetViewportOrgEx */ -INT CDECL MFDRV_OffsetViewportOrg( PHYSDEV dev, INT x, INT y ) +BOOL CDECL MFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) { - if(!MFDRV_MetaParam2( dev, META_OFFSETVIEWPORTORG, x, y )) - return FALSE; - return GDI_NO_MORE_WORK; + return MFDRV_MetaParam2( dev, META_OFFSETVIEWPORTORG, x, y ); } /*********************************************************************** - * MFDRV_OffsetWindowOrg + * MFDRV_OffsetWindowOrgEx */ -INT CDECL MFDRV_OffsetWindowOrg( PHYSDEV dev, INT x, INT y ) +BOOL CDECL MFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) { - if(!MFDRV_MetaParam2( dev, META_OFFSETWINDOWORG, x, y )) - return FALSE; - return GDI_NO_MORE_WORK; + return MFDRV_MetaParam2( dev, META_OFFSETWINDOWORG, x, y ); } /*********************************************************************** - * MFDRV_ScaleViewportExt + * MFDRV_ScaleViewportExtEx */ -INT CDECL MFDRV_ScaleViewportExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom ) +BOOL CDECL MFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) { - if(!MFDRV_MetaParam4( dev, META_SCALEVIEWPORTEXT, xNum, xDenom, yNum, yDenom )) - return FALSE; - return GDI_NO_MORE_WORK; + return MFDRV_MetaParam4( dev, META_SCALEVIEWPORTEXT, xNum, xDenom, yNum, yDenom ); } /*********************************************************************** - * MFDRV_ScaleWindowExt + * MFDRV_ScaleWindowExtEx */ -INT CDECL MFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom ) +BOOL CDECL MFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) { - if(!MFDRV_MetaParam4( dev, META_SCALEWINDOWEXT, xNum, xDenom, yNum, yDenom )) - return FALSE; - return GDI_NO_MORE_WORK; + return MFDRV_MetaParam4( dev, META_SCALEWINDOWEXT, xNum, xDenom, yNum, yDenom ); } diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h index 326192d3ef5..16b1a249960 100644 --- a/dlls/gdi32/mfdrv/metafiledrv.h +++ b/dlls/gdi32/mfdrv/metafiledrv.h @@ -92,8 +92,8 @@ extern BOOL CDECL MFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_LineTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_MoveTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; extern INT CDECL MFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL MFDRV_OffsetViewportOrg( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL MFDRV_OffsetWindowOrg( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; +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; @@ -113,10 +113,10 @@ extern BOOL CDECL MFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) DECLSPEC_HIDDEN; extern INT CDECL MFDRV_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN; -extern INT CDECL MFDRV_ScaleViewportExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, - INT yDenom ) DECLSPEC_HIDDEN; -extern INT CDECL MFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, - INT yDenom ) DECLSPEC_HIDDEN; +extern BOOL CDECL MFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, + INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; +extern BOOL CDECL MFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, + INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; extern HBITMAP CDECL MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN; extern HBRUSH CDECL MFDRV_SelectBrush( PHYSDEV dev, HBRUSH handle ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_SelectClipPath( PHYSDEV dev, INT iMode ) DECLSPEC_HIDDEN; @@ -137,10 +137,10 @@ extern UINT CDECL MFDRV_SetTextAlign( PHYSDEV dev, UINT align ) DECLSPEC_HIDDEN extern INT CDECL MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra ) DECLSPEC_HIDDEN; extern COLORREF CDECL MFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern INT CDECL MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks ) DECLSPEC_HIDDEN; -extern INT CDECL MFDRV_SetViewportExt( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL MFDRV_SetViewportOrg( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL MFDRV_SetWindowExt( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; -extern INT CDECL MFDRV_SetWindowOrg( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN; +extern BOOL CDECL MFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN; +extern BOOL CDECL MFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; +extern BOOL CDECL MFDRV_SetWindowExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN; +extern BOOL CDECL MFDRV_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst, INT heightDst, PHYSDEV devSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index 9ccb9ced664..e734fd29da4 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -846,10 +846,18 @@ static void test_mf_SaveDC(void) /* Need to write something to the emf, otherwise Windows won't play it back */ LineTo(hdcMetafile, 150, 150); - SetWindowOrgEx(hdcMetafile, 0, 0, NULL); - SetViewportOrgEx(hdcMetafile, 0, 0, NULL); - SetWindowExtEx(hdcMetafile, 110, 110, NULL ); - SetViewportExtEx(hdcMetafile, 120, 120, NULL ); + pt.x = pt.y = 5555; + SetWindowOrgEx(hdcMetafile, 0, 0, &pt); + ok( pt.x == 5555 && pt.y == 5555, "wrong origin %d,%d\n", pt.x, pt.y); + pt.x = pt.y = 5555; + SetViewportOrgEx(hdcMetafile, 0, 0, &pt); + ok( pt.x == 5555 && pt.y == 5555, "wrong origin %d,%d\n", pt.x, pt.y); + size.cx = size.cy = 5555; + SetWindowExtEx(hdcMetafile, 110, 110, &size ); + ok( size.cx == 5555 && size.cy == 5555, "wrong size %d,%d\n", size.cx, size.cy ); + size.cx = size.cy = 5555; + SetViewportExtEx(hdcMetafile, 120, 120, &size ); + ok( size.cx == 5555 && size.cy == 5555, "wrong size %d,%d\n", size.cx, size.cy ); /* Force Win9x to update DC state */ SetPixelV(hdcMetafile, 50, 50, 0);