diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c index d0d9d2f14fe..fe6ee84a253 100644 --- a/dlls/gdi32/enhmfdrv/dc.c +++ b/dlls/gdi32/enhmfdrv/dc.c @@ -612,32 +612,6 @@ static BOOL CDECL emfpathdrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, next->funcs->pAngleArc( next, x, y, radius, start, sweep )); } -/*********************************************************************** - * emfpathdrv_Arc - */ -static BOOL CDECL emfpathdrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - INT xstart, INT ystart, INT xend, INT yend ) -{ - PHYSDEV emfdev = get_emfdev( dev ); - PHYSDEV next = GET_NEXT_PHYSDEV( dev, pArc ); - - return (emfdev->funcs->pArc( emfdev, left, top, right, bottom, xstart, ystart, xend, yend ) && - next->funcs->pArc( next, left, top, right, bottom, xstart, ystart, xend, yend )); -} - -/*********************************************************************** - * emfpathdrv_ArcTo - */ -static BOOL CDECL emfpathdrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - INT xstart, INT ystart, INT xend, INT yend ) -{ - PHYSDEV emfdev = get_emfdev( dev ); - PHYSDEV next = GET_NEXT_PHYSDEV( dev, pArcTo ); - - return (emfdev->funcs->pArcTo( emfdev, left, top, right, bottom, xstart, ystart, xend, yend ) && - next->funcs->pArcTo( next, left, top, right, bottom, xstart, ystart, xend, yend )); -} - /*********************************************************************** * emfpathdrv_BeginPath */ @@ -649,19 +623,6 @@ static BOOL CDECL emfpathdrv_BeginPath( PHYSDEV dev ) return (emfdev->funcs->pBeginPath( emfdev ) && next->funcs->pBeginPath( next )); } -/*********************************************************************** - * emfpathdrv_Chord - */ -static BOOL CDECL emfpathdrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - INT xstart, INT ystart, INT xend, INT yend ) -{ - PHYSDEV emfdev = get_emfdev( dev ); - PHYSDEV next = GET_NEXT_PHYSDEV( dev, pChord ); - - return (emfdev->funcs->pChord( emfdev, left, top, right, bottom, xstart, ystart, xend, yend ) && - next->funcs->pChord( next, left, top, right, bottom, xstart, ystart, xend, yend )); -} - /*********************************************************************** * emfpathdrv_CloseFigure */ @@ -734,19 +695,6 @@ static BOOL CDECL emfpathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, next->funcs->pExtTextOut( next, x, y, flags, rect, str, count, dx )); } -/*********************************************************************** - * emfpathdrv_Pie - */ -static BOOL CDECL emfpathdrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - INT xstart, INT ystart, INT xend, INT yend ) -{ - PHYSDEV emfdev = get_emfdev( dev ); - PHYSDEV next = GET_NEXT_PHYSDEV( dev, pPie ); - - return (emfdev->funcs->pPie( emfdev, left, top, right, bottom, xstart, ystart, xend, yend ) && - next->funcs->pPie( next, left, top, right, bottom, xstart, ystart, xend, yend )); -} - /*********************************************************************** * emfpathdrv_PolyBezier */ @@ -875,11 +823,11 @@ static const struct gdi_dc_funcs emfpath_driver = emfpathdrv_AbortPath, /* pAbortPath */ NULL, /* pAlphaBlend */ emfpathdrv_AngleArc, /* pAngleArc */ - emfpathdrv_Arc, /* pArc */ - emfpathdrv_ArcTo, /* pArcTo */ + NULL, /* pArc */ + NULL, /* pArcTo */ emfpathdrv_BeginPath, /* pBeginPath */ NULL, /* pBlendImage */ - emfpathdrv_Chord, /* pChord */ + NULL, /* pChord */ emfpathdrv_CloseFigure, /* pCloseFigure */ NULL, /* pCreateCompatibleDC */ emfpathdrv_CreateDC, /* pCreateDC */ @@ -939,7 +887,7 @@ static const struct gdi_dc_funcs emfpath_driver = NULL, /* pOffsetWindowOrg */ NULL, /* pPaintRgn */ NULL, /* pPatBlt */ - emfpathdrv_Pie, /* pPie */ + NULL, /* pPie */ emfpathdrv_PolyBezier, /* pPolyBezier */ emfpathdrv_PolyBezierTo, /* pPolyBezierTo */ emfpathdrv_PolyDraw, /* pPolyDraw */ diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c index 2c23d0f9ae7..32dd9b645a9 100644 --- a/dlls/gdi32/enhmfdrv/graphics.c +++ b/dlls/gdi32/enhmfdrv/graphics.c @@ -168,14 +168,46 @@ BOOL CDECL EMFDRV_LineTo( PHYSDEV dev, INT x, INT y ) return TRUE; } +/*********************************************************************** + * EMFDC_ArcChordPie + */ +BOOL EMFDC_ArcChordPie( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom, + INT xstart, INT ystart, INT xend, INT yend, DWORD type ) +{ + EMFDRV_PDEVICE *emf = dc_attr->emf; + EMRARC emr; + INT temp; + + if (left == right || top == bottom) return FALSE; + + if (left > right) { temp = left; left = right; right = temp; } + if (top > bottom) { temp = top; top = bottom; bottom = temp; } + + if (dc_attr->graphics_mode == GM_COMPATIBLE) + { + right--; + bottom--; + } + + emr.emr.iType = type; + emr.emr.nSize = sizeof(emr); + emr.rclBox.left = left; + emr.rclBox.top = top; + emr.rclBox.right = right; + emr.rclBox.bottom = bottom; + emr.ptlStart.x = xstart; + emr.ptlStart.y = ystart; + emr.ptlEnd.x = xend; + emr.ptlEnd.y = yend; + return EMFDRV_WriteRecord( &emf->dev, &emr.emr ); +} + /*********************************************************************** * EMFDRV_ArcChordPie */ -static BOOL -EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, - INT xstart, INT ystart, INT xend, INT yend, DWORD iType ) +static BOOL EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, + INT xstart, INT ystart, INT xend, INT yend, DWORD type ) { - EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); DC *dc = get_physdev_dc( dev ); INT temp, xCentre, yCentre, i; double angleStart, angleEnd; @@ -188,12 +220,13 @@ EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, if(left > right) {temp = left; left = right; right = temp;} if(top > bottom) {temp = top; top = bottom; bottom = temp;} - if(dc->attr->graphics_mode == GM_COMPATIBLE) { + if (dc->attr->graphics_mode == GM_COMPATIBLE) + { right--; - bottom--; + bottom--; } - emr.emr.iType = iType; + emr.emr.iType = type; emr.emr.nSize = sizeof(emr); emr.rclBox.left = left; emr.rclBox.top = top; @@ -260,13 +293,14 @@ EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, } /* If we're drawing a pie then make sure we include the centre */ - if(iType == EMR_PIE) { + if (type == EMR_PIE) + { if(bounds.left > xCentre) bounds.left = xCentre; else if(bounds.right < xCentre) bounds.right = xCentre; if(bounds.top > yCentre) bounds.top = yCentre; else if(bounds.bottom < yCentre) bounds.bottom = yCentre; } - if (iType == EMR_ARCTO) + else if (type == EMR_ARCTO) { POINT pt; pt = dc->attr->cur_pos; @@ -275,14 +309,10 @@ EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, bounds.right = max( bounds.right, pt.x ); bounds.bottom = max( bounds.bottom, pt.y ); } - if(!EMFDRV_WriteRecord( dev, &emr.emr )) - return FALSE; - if(!physDev->path) - EMFDRV_UpdateBBox( dev, &bounds ); + EMFDRV_UpdateBBox( dev, &bounds ); return TRUE; } - /*********************************************************************** * EMFDRV_Arc */ @@ -290,7 +320,7 @@ BOOL CDECL EMFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart, - xend, yend, EMR_ARC ); + xend, yend, EMR_ARC ); } /*********************************************************************** @@ -300,7 +330,7 @@ BOOL CDECL EMFDRV_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart, - xend, yend, EMR_ARCTO ); + xend, yend, EMR_ARCTO ); } /*********************************************************************** @@ -310,7 +340,7 @@ BOOL CDECL EMFDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart, - xend, yend, EMR_PIE ); + xend, yend, EMR_PIE ); } @@ -321,7 +351,7 @@ BOOL CDECL EMFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart, - xend, yend, EMR_CHORD ); + xend, yend, EMR_CHORD ); } /*********************************************************************** diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 7f3eeff566c..73ed6989e9e 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -52,6 +52,9 @@ extern BOOL METADC_Pie( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; /* enhanced metafiles */ +extern BOOL EMFDC_ArcChordPie( DC_ATTR *dc_attr, INT left, INT top, INT right, + INT bottom, INT xstart, INT ystart, INT xend, + INT yend, DWORD type ) DECLSPEC_HIDDEN; extern BOOL EMFDC_LineTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL EMFDC_MoveTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c index 57163423e13..2f5b786d726 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/gdidc.c @@ -84,6 +84,8 @@ BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, POINT *pt ) BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { + DC_ATTR *dc_attr; + TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top, right, bottom, xstart, ystart, xend, yend ); @@ -91,6 +93,11 @@ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom, return METADC_Arc( hdc, left, top, right, bottom, xstart, ystart, xend, yend ); + if (!(dc_attr = get_dc_attr( hdc ))) return FALSE; + if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom, + xstart, ystart, xend, yend, EMR_ARC )) + return FALSE; + return NtGdiArcInternal( NtGdiArc, hdc, left, top, right, bottom, xstart, ystart, xend, yend ); } @@ -101,9 +108,16 @@ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom, BOOL WINAPI ArcTo( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { + DC_ATTR *dc_attr; + TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top, right, bottom, xstart, ystart, xend, yend ); + if (!(dc_attr = get_dc_attr( hdc ))) return FALSE; + if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom, + xstart, ystart, xend, yend, EMR_ARCTO )) + return FALSE; + return NtGdiArcInternal( NtGdiArcTo, hdc, left, top, right, bottom, xstart, ystart, xend, yend ); } @@ -114,6 +128,8 @@ BOOL WINAPI ArcTo( HDC hdc, INT left, INT top, INT right, INT bottom, BOOL WINAPI Chord( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { + DC_ATTR *dc_attr; + TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top, right, bottom, xstart, ystart, xend, yend ); @@ -121,6 +137,11 @@ BOOL WINAPI Chord( HDC hdc, INT left, INT top, INT right, INT bottom, return METADC_Chord( hdc, left, top, right, bottom, xstart, ystart, xend, yend ); + if (!(dc_attr = get_dc_attr( hdc ))) return FALSE; + if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom, + xstart, ystart, xend, yend, EMR_CHORD )) + return FALSE; + return NtGdiArcInternal( NtGdiChord, hdc, left, top, right, bottom, xstart, ystart, xend, yend ); } @@ -131,6 +152,8 @@ BOOL WINAPI Chord( HDC hdc, INT left, INT top, INT right, INT bottom, BOOL WINAPI Pie( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) { + DC_ATTR *dc_attr; + TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top, right, bottom, xstart, ystart, xend, yend ); @@ -138,6 +161,11 @@ BOOL WINAPI Pie( HDC hdc, INT left, INT top, INT right, INT bottom, return METADC_Pie( hdc, left, top, right, bottom, xstart, ystart, xend, yend ); + if (!(dc_attr = get_dc_attr( hdc ))) return FALSE; + if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom, + xstart, ystart, xend, yend, EMR_PIE )) + return FALSE; + return NtGdiArcInternal( NtGdiPie, hdc, left, top, right, bottom, xstart, ystart, xend, yend ); }