Jacek Caban : gdi32: Directly use ntgdi functions in painting.c.
Alexandre Julliard
julliard at winehq.org
Wed Sep 15 16:21:31 CDT 2021
Module: wine
Branch: master
Commit: 9f88685f5460da2bf6e39f24191a6b65be7baec8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9f88685f5460da2bf6e39f24191a6b65be7baec8
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Sep 14 21:52:55 2021 +0200
gdi32: Directly use ntgdi functions in painting.c.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/painting.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index a7f06ea7df3..dba91daf788 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -40,13 +40,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdi);
BOOL CDECL nulldrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep )
{
+ DC *dc = get_physdev_dc( dev );
INT x1 = GDI_ROUND( x + cos( start * M_PI / 180 ) * radius );
INT y1 = GDI_ROUND( y - sin( start * M_PI / 180 ) * radius );
INT x2 = GDI_ROUND( x + cos( (start + sweep) * M_PI / 180) * radius );
INT y2 = GDI_ROUND( y - sin( (start + sweep) * M_PI / 180) * radius );
- INT arcdir = SetArcDirection( dev->hdc, sweep >= 0 ? AD_COUNTERCLOCKWISE : AD_CLOCKWISE );
- BOOL ret = ArcTo( dev->hdc, x - radius, y - radius, x + radius, y + radius, x1, y1, x2, y2 );
- SetArcDirection( dev->hdc, arcdir );
+ INT arcdir = dc->attr->arc_direction;
+ BOOL ret;
+ dc->attr->arc_direction = sweep >= 0 ? AD_COUNTERCLOCKWISE : AD_CLOCKWISE;
+ ret = NtGdiArcInternal( NtGdiArcTo, dev->hdc, x - radius, y - radius, x + radius, y + radius,
+ x1, y1, x2, y2 );
+ dc->attr->arc_direction = arcdir;
return ret;
}
@@ -64,9 +68,10 @@ BOOL CDECL nulldrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
if (!height || !width) return FALSE;
/* draw a line from the current position to the starting point of the arc, then draw the arc */
angle = atan2( (ystart - ycenter) / height, (xstart - xcenter) / width );
- LineTo( dev->hdc, GDI_ROUND( xcenter + cos(angle) * xradius ),
- GDI_ROUND( ycenter + sin(angle) * yradius ));
- return Arc( dev->hdc, left, top, right, bottom, xstart, ystart, xend, yend );
+ NtGdiLineTo( dev->hdc, GDI_ROUND( xcenter + cos(angle) * xradius ),
+ GDI_ROUND( ycenter + sin(angle) * yradius ));
+ return NtGdiArcInternal( NtGdiArc, dev->hdc, left, top, right, bottom,
+ xstart, ystart, xend, yend );
}
BOOL CDECL nulldrv_FillRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush )
@@ -99,9 +104,12 @@ BOOL CDECL nulldrv_FrameRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush, INT width, INT
BOOL CDECL nulldrv_InvertRgn( PHYSDEV dev, HRGN rgn )
{
- INT prev_rop = SetROP2( dev->hdc, R2_NOT );
- BOOL ret = NtGdiFillRgn( dev->hdc, rgn, get_stock_object(BLACK_BRUSH) );
- SetROP2( dev->hdc, prev_rop );
+ DC *dc = get_physdev_dc( dev );
+ INT prev_rop = dc->attr->rop_mode;
+ BOOL ret;
+ dc->attr->rop_mode = R2_NOT;
+ ret = NtGdiFillRgn( dev->hdc, rgn, get_stock_object(BLACK_BRUSH) );
+ dc->attr->rop_mode = prev_rop;
return ret;
}
More information about the wine-cvs
mailing list