gdi32: Add null driver entry points for the various DC settings functions.

This commit is contained in:
Alexandre Julliard 2011-03-10 21:58:47 +01:00
parent 75f792d729
commit 965d41717b
8 changed files with 229 additions and 144 deletions

View File

@ -122,6 +122,7 @@ DC *alloc_dc_ptr( const DC_FUNCTIONS *funcs, WORD magic )
dc->textColor = RGB( 0, 0, 0 ); dc->textColor = RGB( 0, 0, 0 );
dc->brushOrgX = 0; dc->brushOrgX = 0;
dc->brushOrgY = 0; dc->brushOrgY = 0;
dc->mapperFlags = 0;
dc->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP; dc->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
dc->charExtra = 0; dc->charExtra = 0;
dc->breakExtra = 0; dc->breakExtra = 0;
@ -399,6 +400,7 @@ INT save_dc_state( HDC hdc )
newdc->dcPenColor = dc->dcPenColor; newdc->dcPenColor = dc->dcPenColor;
newdc->brushOrgX = dc->brushOrgX; newdc->brushOrgX = dc->brushOrgX;
newdc->brushOrgY = dc->brushOrgY; newdc->brushOrgY = dc->brushOrgY;
newdc->mapperFlags = dc->mapperFlags;
newdc->textAlign = dc->textAlign; newdc->textAlign = dc->textAlign;
newdc->charExtra = dc->charExtra; newdc->charExtra = dc->charExtra;
newdc->breakExtra = dc->breakExtra; newdc->breakExtra = dc->breakExtra;
@ -535,6 +537,7 @@ BOOL restore_dc_state( HDC hdc, INT level )
dc->dcPenColor = dcs->dcPenColor; dc->dcPenColor = dcs->dcPenColor;
dc->brushOrgX = dcs->brushOrgX; dc->brushOrgX = dcs->brushOrgX;
dc->brushOrgY = dcs->brushOrgY; dc->brushOrgY = dcs->brushOrgY;
dc->mapperFlags = dcs->mapperFlags;
dc->textAlign = dcs->textAlign; dc->textAlign = dcs->textAlign;
dc->charExtra = dcs->charExtra; dc->charExtra = dcs->charExtra;
dc->breakExtra = dcs->breakExtra; dc->breakExtra = dcs->breakExtra;
@ -994,25 +997,23 @@ COLORREF WINAPI GetBkColor( HDC hdc )
*/ */
COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color ) COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
{ {
COLORREF oldColor; COLORREF ret = CLR_INVALID;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
TRACE("hdc=%p color=0x%08x\n", hdc, color); TRACE("hdc=%p color=0x%08x\n", hdc, color);
if (!dc) return CLR_INVALID; if (dc)
oldColor = dc->backgroundColor;
if (dc->funcs->pSetBkColor)
{ {
color = dc->funcs->pSetBkColor(dc->physDev, color); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetBkColor );
if (color == CLR_INVALID) /* don't change it */ color = physdev->funcs->pSetBkColor( physdev, color );
if (color != CLR_INVALID)
{ {
color = oldColor; ret = dc->backgroundColor;
oldColor = CLR_INVALID;
}
}
dc->backgroundColor = color; dc->backgroundColor = color;
}
release_dc_ptr( dc ); release_dc_ptr( dc );
return oldColor; }
return ret;
} }
@ -1037,25 +1038,23 @@ COLORREF WINAPI GetTextColor( HDC hdc )
*/ */
COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color ) COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
{ {
COLORREF oldColor; COLORREF ret = CLR_INVALID;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
TRACE(" hdc=%p color=0x%08x\n", hdc, color); TRACE(" hdc=%p color=0x%08x\n", hdc, color);
if (!dc) return CLR_INVALID; if (dc)
oldColor = dc->textColor;
if (dc->funcs->pSetTextColor)
{ {
color = dc->funcs->pSetTextColor(dc->physDev, color); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetTextColor );
if (color == CLR_INVALID) /* don't change it */ color = physdev->funcs->pSetTextColor( physdev, color );
if (color != CLR_INVALID)
{ {
color = oldColor; ret = dc->textColor;
oldColor = CLR_INVALID;
}
}
dc->textColor = color; dc->textColor = color;
}
release_dc_ptr( dc ); release_dc_ptr( dc );
return oldColor; }
return ret;
} }
@ -1080,19 +1079,22 @@ UINT WINAPI GetTextAlign( HDC hdc )
*/ */
UINT WINAPI SetTextAlign( HDC hdc, UINT align ) UINT WINAPI SetTextAlign( HDC hdc, UINT align )
{ {
UINT ret; UINT ret = GDI_ERROR;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
TRACE("hdc=%p align=%d\n", hdc, align); TRACE("hdc=%p align=%d\n", hdc, align);
if (!dc) return 0x0; if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetTextAlign );
align = physdev->funcs->pSetTextAlign( physdev, align );
if (align != GDI_ERROR)
{
ret = dc->textAlign; ret = dc->textAlign;
if (dc->funcs->pSetTextAlign)
if (!dc->funcs->pSetTextAlign(dc->physDev, align))
ret = GDI_ERROR;
if (ret != GDI_ERROR)
dc->textAlign = align; dc->textAlign = align;
}
release_dc_ptr( dc ); release_dc_ptr( dc );
}
return ret; return ret;
} }
@ -1171,12 +1173,12 @@ INT WINAPI GetArcDirection( HDC hdc )
/*********************************************************************** /***********************************************************************
* SetArcDirection (GDI32.@) * SetArcDirection (GDI32.@)
*/ */
INT WINAPI SetArcDirection( HDC hdc, INT nDirection ) INT WINAPI SetArcDirection( HDC hdc, INT dir )
{ {
DC * dc; DC * dc;
INT nOldDirection = 0; INT ret = 0;
if (nDirection!=AD_COUNTERCLOCKWISE && nDirection!=AD_CLOCKWISE) if (dir != AD_COUNTERCLOCKWISE && dir != AD_CLOCKWISE)
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
@ -1184,15 +1186,16 @@ INT WINAPI SetArcDirection( HDC hdc, INT nDirection )
if ((dc = get_dc_ptr( hdc ))) if ((dc = get_dc_ptr( hdc )))
{ {
if (dc->funcs->pSetArcDirection) PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetArcDirection );
dir = physdev->funcs->pSetArcDirection( physdev, dir );
if (dir)
{ {
dc->funcs->pSetArcDirection(dc->physDev, nDirection); ret = dc->ArcDirection;
dc->ArcDirection = dir;
} }
nOldDirection = dc->ArcDirection;
dc->ArcDirection = nDirection;
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return nOldDirection; return ret;
} }
@ -1694,22 +1697,25 @@ INT WINAPI GetBkMode( HDC hdc )
*/ */
INT WINAPI SetBkMode( HDC hdc, INT mode ) INT WINAPI SetBkMode( HDC hdc, INT mode )
{ {
INT ret; INT ret = 0;
DC *dc; DC *dc;
if ((mode <= 0) || (mode > BKMODE_LAST)) if ((mode <= 0) || (mode > BKMODE_LAST))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
} }
if (!(dc = get_dc_ptr( hdc ))) return 0; if ((dc = get_dc_ptr( hdc )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetBkMode );
mode = physdev->funcs->pSetBkMode( physdev, mode );
if (mode)
{
ret = dc->backgroundMode; ret = dc->backgroundMode;
if (dc->funcs->pSetBkMode)
if (!dc->funcs->pSetBkMode( dc->physDev, mode ))
ret = 0;
if (ret)
dc->backgroundMode = mode; dc->backgroundMode = mode;
}
release_dc_ptr( dc ); release_dc_ptr( dc );
}
return ret; return ret;
} }
@ -1735,21 +1741,25 @@ INT WINAPI GetROP2( HDC hdc )
*/ */
INT WINAPI SetROP2( HDC hdc, INT mode ) INT WINAPI SetROP2( HDC hdc, INT mode )
{ {
INT ret; INT ret = 0;
DC *dc; DC *dc;
if ((mode < R2_BLACK) || (mode > R2_WHITE)) if ((mode < R2_BLACK) || (mode > R2_WHITE))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
} }
if (!(dc = get_dc_ptr( hdc ))) return 0; if ((dc = get_dc_ptr( hdc )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetROP2 );
mode = physdev->funcs->pSetROP2( physdev, mode );
if (mode)
{
ret = dc->ROPmode; ret = dc->ROPmode;
if (dc->funcs->pSetROP2)
if (!dc->funcs->pSetROP2( dc->physDev, mode ))
ret = 0;
if (ret)
dc->ROPmode = mode; dc->ROPmode = mode;
}
release_dc_ptr( dc ); release_dc_ptr( dc );
}
return ret; return ret;
} }
@ -1759,22 +1769,25 @@ INT WINAPI SetROP2( HDC hdc, INT mode )
*/ */
INT WINAPI SetRelAbs( HDC hdc, INT mode ) INT WINAPI SetRelAbs( HDC hdc, INT mode )
{ {
INT ret; INT ret = 0;
DC *dc; DC *dc;
if ((mode != ABSOLUTE) && (mode != RELATIVE)) if ((mode != ABSOLUTE) && (mode != RELATIVE))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
} }
if (!(dc = get_dc_ptr( hdc ))) return 0; if ((dc = get_dc_ptr( hdc )))
if (dc->funcs->pSetRelAbs) {
ret = dc->funcs->pSetRelAbs( dc->physDev, mode ); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetRelAbs );
else mode = physdev->funcs->pSetRelAbs( physdev, mode );
if (mode)
{ {
ret = dc->relAbsMode; ret = dc->relAbsMode;
dc->relAbsMode = mode; dc->relAbsMode = mode;
} }
release_dc_ptr( dc ); release_dc_ptr( dc );
}
return ret; return ret;
} }
@ -1800,21 +1813,25 @@ INT WINAPI GetPolyFillMode( HDC hdc )
*/ */
INT WINAPI SetPolyFillMode( HDC hdc, INT mode ) INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
{ {
INT ret; INT ret = 0;
DC *dc; DC *dc;
if ((mode <= 0) || (mode > POLYFILL_LAST)) if ((mode <= 0) || (mode > POLYFILL_LAST))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
} }
if (!(dc = get_dc_ptr( hdc ))) return 0; if ((dc = get_dc_ptr( hdc )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetPolyFillMode );
mode = physdev->funcs->pSetPolyFillMode( physdev, mode );
if (mode)
{
ret = dc->polyFillMode; ret = dc->polyFillMode;
if (dc->funcs->pSetPolyFillMode)
if (!dc->funcs->pSetPolyFillMode( dc->physDev, mode ))
ret = 0;
if (ret)
dc->polyFillMode = mode; dc->polyFillMode = mode;
}
release_dc_ptr( dc ); release_dc_ptr( dc );
}
return ret; return ret;
} }
@ -1840,21 +1857,25 @@ INT WINAPI GetStretchBltMode( HDC hdc )
*/ */
INT WINAPI SetStretchBltMode( HDC hdc, INT mode ) INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
{ {
INT ret; INT ret = 0;
DC *dc; DC *dc;
if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE)) if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE))
{ {
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return 0; return 0;
} }
if (!(dc = get_dc_ptr( hdc ))) return 0; if ((dc = get_dc_ptr( hdc )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetStretchBltMode );
mode = physdev->funcs->pSetStretchBltMode( physdev, mode );
if (mode)
{
ret = dc->stretchBltMode; ret = dc->stretchBltMode;
if (dc->funcs->pSetStretchBltMode)
if (!dc->funcs->pSetStretchBltMode( dc->physDev, mode ))
ret = 0;
if (ret)
dc->stretchBltMode = mode; dc->stretchBltMode = mode;
}
release_dc_ptr( dc ); release_dc_ptr( dc );
}
return ret; return ret;
} }

View File

@ -438,6 +438,21 @@ static HPEN CDECL nulldrv_SelectPen( PHYSDEV dev, HPEN pen )
return pen; return pen;
} }
static INT CDECL nulldrv_SetArcDirection( PHYSDEV dev, INT dir )
{
return dir;
}
static COLORREF CDECL nulldrv_SetBkColor( PHYSDEV dev, COLORREF color )
{
return color;
}
static INT CDECL nulldrv_SetBkMode( PHYSDEV dev, INT mode )
{
return mode;
}
static COLORREF CDECL nulldrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) static COLORREF CDECL nulldrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
{ {
return color; return color;
@ -452,11 +467,56 @@ static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN cli
{ {
} }
static DWORD CDECL nulldrv_SetMapperFlags( PHYSDEV dev, DWORD flags )
{
return flags;
}
static COLORREF CDECL nulldrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) static COLORREF CDECL nulldrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
{ {
return color; return color;
} }
static INT CDECL nulldrv_SetPolyFillMode( PHYSDEV dev, INT mode )
{
return mode;
}
static INT CDECL nulldrv_SetROP2( PHYSDEV dev, INT rop )
{
return rop;
}
static INT CDECL nulldrv_SetRelAbs( PHYSDEV dev, INT mode )
{
return mode;
}
static INT CDECL nulldrv_SetStretchBltMode( PHYSDEV dev, INT mode )
{
return mode;
}
static UINT CDECL nulldrv_SetTextAlign( PHYSDEV dev, UINT align )
{
return align;
}
static INT CDECL nulldrv_SetTextCharacterExtra( PHYSDEV dev, INT extra )
{
return extra;
}
static COLORREF CDECL nulldrv_SetTextColor( PHYSDEV dev, COLORREF color )
{
return color;
}
static BOOL CDECL nulldrv_SetTextJustification( PHYSDEV dev, INT extra, INT breaks )
{
return TRUE;
}
static INT CDECL nulldrv_StartDoc( PHYSDEV dev, const DOCINFOW *info ) static INT CDECL nulldrv_StartDoc( PHYSDEV dev, const DOCINFOW *info )
{ {
return 0; return 0;
@ -612,10 +672,10 @@ const DC_FUNCTIONS null_driver =
nulldrv_SelectFont, /* pSelectFont */ nulldrv_SelectFont, /* pSelectFont */
nulldrv_SelectPalette, /* pSelectPalette */ nulldrv_SelectPalette, /* pSelectPalette */
nulldrv_SelectPen, /* pSelectPen */ nulldrv_SelectPen, /* pSelectPen */
NULL, /* pSetArcDirection */ nulldrv_SetArcDirection, /* pSetArcDirection */
NULL, /* pSetBitmapBits */ NULL, /* pSetBitmapBits */
NULL, /* pSetBkColor */ nulldrv_SetBkColor, /* pSetBkColor */
NULL, /* pSetBkMode */ nulldrv_SetBkMode, /* pSetBkMode */
nulldrv_SetDCBrushColor, /* pSetDCBrushColor */ nulldrv_SetDCBrushColor, /* pSetDCBrushColor */
nulldrv_SetDCPenColor, /* pSetDCPenColor */ nulldrv_SetDCPenColor, /* pSetDCPenColor */
NULL, /* pSetDIBColorTable */ NULL, /* pSetDIBColorTable */
@ -624,17 +684,17 @@ const DC_FUNCTIONS null_driver =
nulldrv_SetDeviceClipping, /* pSetDeviceClipping */ nulldrv_SetDeviceClipping, /* pSetDeviceClipping */
NULL, /* pSetDeviceGammaRamp */ NULL, /* pSetDeviceGammaRamp */
nulldrv_SetMapMode, /* pSetMapMode */ nulldrv_SetMapMode, /* pSetMapMode */
NULL, /* pSetMapperFlags */ nulldrv_SetMapperFlags, /* pSetMapperFlags */
nulldrv_SetPixel, /* pSetPixel */ nulldrv_SetPixel, /* pSetPixel */
NULL, /* pSetPixelFormat */ NULL, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */ nulldrv_SetPolyFillMode, /* pSetPolyFillMode */
NULL, /* pSetROP2 */ nulldrv_SetROP2, /* pSetROP2 */
NULL, /* pSetRelAbs */ nulldrv_SetRelAbs, /* pSetRelAbs */
NULL, /* pSetStretchBltMode */ nulldrv_SetStretchBltMode, /* pSetStretchBltMode */
NULL, /* pSetTextAlign */ nulldrv_SetTextAlign, /* pSetTextAlign */
NULL, /* pSetTextCharacterExtra */ nulldrv_SetTextCharacterExtra, /* pSetTextCharacterExtra */
NULL, /* pSetTextColor */ nulldrv_SetTextColor, /* pSetTextColor */
NULL, /* pSetTextJustification */ nulldrv_SetTextJustification, /* pSetTextJustification */
nulldrv_SetViewportExtEx, /* pSetViewportExt */ nulldrv_SetViewportExtEx, /* pSetViewportExt */
nulldrv_SetViewportOrgEx, /* pSetViewportOrg */ nulldrv_SetViewportOrgEx, /* pSetViewportOrg */
nulldrv_SetWindowExtEx, /* pSetWindowExt */ nulldrv_SetWindowExtEx, /* pSetWindowExt */

View File

@ -68,7 +68,7 @@ UINT CDECL EMFDRV_SetTextAlign( PHYSDEV dev, UINT align )
emr.emr.iType = EMR_SETTEXTALIGN; emr.emr.iType = EMR_SETTEXTALIGN;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = align; emr.iMode = align;
return EMFDRV_WriteRecord( dev, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr ) ? align : GDI_ERROR;
} }
BOOL CDECL EMFDRV_SetTextJustification(PHYSDEV dev, INT nBreakExtra, INT nBreakCount) BOOL CDECL EMFDRV_SetTextJustification(PHYSDEV dev, INT nBreakExtra, INT nBreakCount)
@ -87,7 +87,7 @@ INT CDECL EMFDRV_SetBkMode( PHYSDEV dev, INT mode )
emr.emr.iType = EMR_SETBKMODE; emr.emr.iType = EMR_SETBKMODE;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = mode; emr.iMode = mode;
return EMFDRV_WriteRecord( dev, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr ) ? mode : 0;
} }
INT CDECL EMFDRV_SetROP2( PHYSDEV dev, INT rop ) INT CDECL EMFDRV_SetROP2( PHYSDEV dev, INT rop )
@ -96,7 +96,7 @@ INT CDECL EMFDRV_SetROP2( PHYSDEV dev, INT rop )
emr.emr.iType = EMR_SETROP2; emr.emr.iType = EMR_SETROP2;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = rop; emr.iMode = rop;
return EMFDRV_WriteRecord( dev, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr ) ? rop : 0;
} }
INT CDECL EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode ) INT CDECL EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
@ -105,7 +105,7 @@ INT CDECL EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
emr.emr.iType = EMR_SETPOLYFILLMODE; emr.emr.iType = EMR_SETPOLYFILLMODE;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = mode; emr.iMode = mode;
return EMFDRV_WriteRecord( dev, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr ) ? mode : 0;
} }
INT CDECL EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode ) INT CDECL EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
@ -114,7 +114,7 @@ INT CDECL EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
emr.emr.iType = EMR_SETSTRETCHBLTMODE; emr.emr.iType = EMR_SETSTRETCHBLTMODE;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = mode; emr.iMode = mode;
return EMFDRV_WriteRecord( dev, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr ) ? mode : 0;
} }
INT CDECL EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) INT CDECL EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
@ -186,7 +186,7 @@ DWORD CDECL EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.dwFlags = flags; emr.dwFlags = flags;
return EMFDRV_WriteRecord( dev, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr ) ? flags : GDI_ERROR;
} }
BOOL CDECL EMFDRV_AbortPath( PHYSDEV dev ) BOOL CDECL EMFDRV_AbortPath( PHYSDEV dev )

View File

@ -866,9 +866,5 @@ INT CDECL EMFDRV_SetArcDirection(PHYSDEV dev, INT arcDirection)
emr.emr.iType = EMR_SETARCDIRECTION; emr.emr.iType = EMR_SETARCDIRECTION;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iArcDirection = arcDirection; emr.iArcDirection = arcDirection;
return EMFDRV_WriteRecord(dev, &emr.emr) ? arcDirection : 0;
EMFDRV_WriteRecord(dev, &emr.emr);
/* We don't know the old arc direction and we don't care... */
return 0;
} }

View File

@ -806,18 +806,21 @@ INT WINAPI GetTextCharacterExtra( HDC hdc )
*/ */
INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra ) INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
{ {
INT prev; INT ret = 0x80000000;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
if (!dc) return 0x80000000;
if (dc->funcs->pSetTextCharacterExtra) if (dc)
prev = dc->funcs->pSetTextCharacterExtra( dc->physDev, extra );
else
{ {
prev = dc->charExtra; PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetTextCharacterExtra );
extra = physdev->funcs->pSetTextCharacterExtra( physdev, extra );
if (extra != 0x80000000)
{
ret = dc->charExtra;
dc->charExtra = extra; dc->charExtra = extra;
} }
release_dc_ptr( dc ); release_dc_ptr( dc );
return prev; }
return ret;
} }
@ -826,12 +829,15 @@ INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
*/ */
BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks ) BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
{ {
BOOL ret = TRUE; BOOL ret;
PHYSDEV physdev;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pSetTextJustification)
ret = dc->funcs->pSetTextJustification( dc->physDev, extra, breaks ); physdev = GET_DC_PHYSDEV( dc, pSetTextJustification );
else ret = physdev->funcs->pSetTextJustification( physdev, extra, breaks );
if (ret)
{ {
extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX); extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
if (!extra) breaks = 0; if (!extra) breaks = 0;
@ -2314,19 +2320,22 @@ BOOL WINAPI PolyTextOutW( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
/*********************************************************************** /***********************************************************************
* SetMapperFlags (GDI32.@) * SetMapperFlags (GDI32.@)
*/ */
DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag ) DWORD WINAPI SetMapperFlags( HDC hdc, DWORD flags )
{ {
DC *dc = get_dc_ptr( hDC ); DC *dc = get_dc_ptr( hdc );
DWORD ret = 0; DWORD ret = GDI_ERROR;
if(!dc) return 0;
if(dc->funcs->pSetMapperFlags) if (dc)
{ {
ret = dc->funcs->pSetMapperFlags( dc->physDev, dwFlag ); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetMapperFlags );
/* FIXME: ret is just a success flag, we should return a proper value */ flags = physdev->funcs->pSetMapperFlags( physdev, flags );
if (flags != GDI_ERROR)
{
ret = dc->mapperFlags;
dc->mapperFlags = flags;
} }
else
FIXME("(%p, 0x%08x): stub - harmless\n", hDC, dwFlag);
release_dc_ptr( dc ); release_dc_ptr( dc );
}
return ret; return ret;
} }

View File

@ -185,8 +185,8 @@ typedef struct tagDC_FUNCS
INT (CDECL *pSetStretchBltMode)(PHYSDEV,INT); INT (CDECL *pSetStretchBltMode)(PHYSDEV,INT);
UINT (CDECL *pSetTextAlign)(PHYSDEV,UINT); UINT (CDECL *pSetTextAlign)(PHYSDEV,UINT);
INT (CDECL *pSetTextCharacterExtra)(PHYSDEV,INT); INT (CDECL *pSetTextCharacterExtra)(PHYSDEV,INT);
DWORD (CDECL *pSetTextColor)(PHYSDEV,DWORD); COLORREF (CDECL *pSetTextColor)(PHYSDEV,COLORREF);
INT (CDECL *pSetTextJustification)(PHYSDEV,INT,INT); BOOL (CDECL *pSetTextJustification)(PHYSDEV,INT,INT);
BOOL (CDECL *pSetViewportExtEx)(PHYSDEV,INT,INT,SIZE*); BOOL (CDECL *pSetViewportExtEx)(PHYSDEV,INT,INT,SIZE*);
BOOL (CDECL *pSetViewportOrgEx)(PHYSDEV,INT,INT,POINT*); BOOL (CDECL *pSetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
BOOL (CDECL *pSetWindowExtEx)(PHYSDEV,INT,INT,SIZE*); BOOL (CDECL *pSetWindowExtEx)(PHYSDEV,INT,INT,SIZE*);
@ -298,6 +298,7 @@ typedef struct tagDC
short brushOrgX; short brushOrgX;
short brushOrgY; short brushOrgY;
DWORD mapperFlags; /* Font mapper flags */
WORD textAlign; /* Text alignment from SetTextAlign() */ WORD textAlign; /* Text alignment from SetTextAlign() */
INT charExtra; /* Spacing from SetTextCharacterExtra() */ INT charExtra; /* Spacing from SetTextCharacterExtra() */
INT breakExtra; /* breakTotalExtra / breakCount */ INT breakExtra; /* breakTotalExtra / breakCount */

View File

@ -32,32 +32,32 @@ BOOL CDECL MFDRV_RestoreDC( PHYSDEV dev, INT level )
UINT CDECL MFDRV_SetTextAlign( PHYSDEV dev, UINT align ) UINT CDECL MFDRV_SetTextAlign( PHYSDEV dev, UINT align )
{ {
return MFDRV_MetaParam2( dev, META_SETTEXTALIGN, HIWORD(align), LOWORD(align)); return MFDRV_MetaParam2( dev, META_SETTEXTALIGN, HIWORD(align), LOWORD(align)) ? align : GDI_ERROR;
} }
INT CDECL MFDRV_SetBkMode( PHYSDEV dev, INT mode ) INT CDECL MFDRV_SetBkMode( PHYSDEV dev, INT mode )
{ {
return MFDRV_MetaParam1( dev, META_SETBKMODE, (WORD)mode); return MFDRV_MetaParam1( dev, META_SETBKMODE, (WORD)mode) ? mode : 0;
} }
INT CDECL MFDRV_SetROP2( PHYSDEV dev, INT rop ) INT CDECL MFDRV_SetROP2( PHYSDEV dev, INT rop )
{ {
return MFDRV_MetaParam1( dev, META_SETROP2, (WORD)rop); return MFDRV_MetaParam1( dev, META_SETROP2, (WORD)rop) ? rop : 0;
} }
INT CDECL MFDRV_SetRelAbs( PHYSDEV dev, INT mode ) INT CDECL MFDRV_SetRelAbs( PHYSDEV dev, INT mode )
{ {
return MFDRV_MetaParam1( dev, META_SETRELABS, (WORD)mode); return MFDRV_MetaParam1( dev, META_SETRELABS, (WORD)mode) ? mode : 0;
} }
INT CDECL MFDRV_SetPolyFillMode( PHYSDEV dev, INT mode ) INT CDECL MFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
{ {
return MFDRV_MetaParam1( dev, META_SETPOLYFILLMODE, (WORD)mode); return MFDRV_MetaParam1( dev, META_SETPOLYFILLMODE, (WORD)mode) ? mode : 0;
} }
INT CDECL MFDRV_SetStretchBltMode( PHYSDEV dev, INT mode ) INT CDECL MFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
{ {
return MFDRV_MetaParam1( dev, META_SETSTRETCHBLTMODE, (WORD)mode); return MFDRV_MetaParam1( dev, META_SETSTRETCHBLTMODE, (WORD)mode) ? mode : 0;
} }
INT CDECL MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) INT CDECL MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
@ -77,22 +77,20 @@ INT CDECL MFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
return MFDRV_MetaParam2( dev, META_OFFSETCLIPRGN, x, y ); return MFDRV_MetaParam2( dev, META_OFFSETCLIPRGN, x, y );
} }
INT CDECL MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks ) BOOL CDECL MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks )
{ {
return MFDRV_MetaParam2( dev, META_SETTEXTJUSTIFICATION, extra, breaks ); return MFDRV_MetaParam2( dev, META_SETTEXTJUSTIFICATION, extra, breaks );
} }
INT CDECL MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra ) INT CDECL MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra )
{ {
if(!MFDRV_MetaParam1( dev, META_SETTEXTCHAREXTRA, extra )) return MFDRV_MetaParam1( dev, META_SETTEXTCHAREXTRA, extra ) ? extra : 0x80000000;
return 0x80000000;
return TRUE;
} }
DWORD CDECL MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) DWORD CDECL MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
{ {
return MFDRV_MetaParam2( dev, META_SETMAPPERFLAGS, HIWORD(flags), return MFDRV_MetaParam2( dev, META_SETMAPPERFLAGS, HIWORD(flags),
LOWORD(flags) ); LOWORD(flags) ) ? flags : GDI_ERROR;
} }
BOOL CDECL MFDRV_AbortPath( PHYSDEV dev ) BOOL CDECL MFDRV_AbortPath( PHYSDEV dev )

View File

@ -138,7 +138,7 @@ extern INT CDECL MFDRV_SetStretchBltMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDD
extern UINT CDECL MFDRV_SetTextAlign( PHYSDEV dev, UINT align ) DECLSPEC_HIDDEN; extern UINT CDECL MFDRV_SetTextAlign( PHYSDEV dev, UINT align ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra ) 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 COLORREF CDECL MFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) 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_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_SetWindowExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;