Alexandre Julliard : gdi32: Add support for updating a region from the pen backend functions instead of painting directly .

Alexandre Julliard julliard at winehq.org
Thu Dec 29 12:15:44 CST 2011


Module: wine
Branch: master
Commit: 0429d9181f211e40f1fc922185a8924048f199c4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0429d9181f211e40f1fc922185a8924048f199c4

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec 28 11:56:24 2011 +0100

gdi32: Add support for updating a region from the pen backend functions instead of painting directly.

---

 dlls/gdi32/dibdrv/dibdrv.h   |    2 +-
 dlls/gdi32/dibdrv/graphics.c |    8 ++++----
 dlls/gdi32/dibdrv/objects.c  |   21 ++++++++++-----------
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h
index 5d9ecb6..fa8d445 100644
--- a/dlls/gdi32/dibdrv/dibdrv.h
+++ b/dlls/gdi32/dibdrv/dibdrv.h
@@ -89,7 +89,7 @@ typedef struct dibdrv_physdev
     dash_pattern pen_pattern;
     dash_pos dash_pos;
     rop_mask dash_masks[2];
-    BOOL   (* pen_lines)(struct dibdrv_physdev *pdev, int num, POINT *pts, BOOL close);
+    BOOL   (* pen_lines)(struct dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region);
 
     /* brush */
     UINT brush_style;
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index e5aad2a..e8b45a1 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -453,7 +453,7 @@ BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y )
 
     reset_dash_origin(pdev);
 
-    if(defer_pen(pdev) || !pdev->pen_lines(pdev, 2, pts, FALSE))
+    if(defer_pen(pdev) || !pdev->pen_lines(pdev, 2, pts, FALSE, 0))
         return next->funcs->pLineTo( next, x, y );
 
     return TRUE;
@@ -532,7 +532,7 @@ BOOL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWO
         LPtoDP( dev->hdc, points, counts[i] );
 
         reset_dash_origin( pdev );
-        pdev->pen_lines( pdev, counts[i], points, FALSE );
+        pdev->pen_lines( pdev, counts[i], points, FALSE, 0 );
     }
 
     HeapFree( GetProcessHeap(), 0, points );
@@ -557,7 +557,7 @@ BOOL dibdrv_Polyline( PHYSDEV dev, const POINT* pt, INT count )
     LPtoDP( dev->hdc, points, count );
 
     reset_dash_origin( pdev );
-    pdev->pen_lines( pdev, count, points, FALSE );
+    pdev->pen_lines( pdev, count, points, FALSE, 0 );
 
     HeapFree( GetProcessHeap(), 0, points );
     return TRUE;
@@ -596,7 +596,7 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
     pts[1].x = pts[2].x = rect.left;
     pts[2].y = pts[3].y = rect.bottom - 1;
 
-    pdev->pen_lines(pdev, 4, pts, TRUE);
+    pdev->pen_lines(pdev, 4, pts, TRUE, 0);
 
     rect.left   += (pdev->pen_width + 1) / 2;
     rect.top    += (pdev->pen_width + 1) / 2;
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index 46f3092..bf821f2 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -631,7 +631,7 @@ static BOOL solid_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end, DWORD
     return TRUE;
 }
 
-static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close)
+static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
 {
     int i;
     DWORD color, and, xor;
@@ -927,7 +927,7 @@ static BOOL dashed_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end)
     return TRUE;
 }
 
-static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close)
+static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
 {
     int i;
 
@@ -945,7 +945,7 @@ static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL clo
     return TRUE;
 }
 
-static BOOL null_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close)
+static BOOL null_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
 {
     return TRUE;
 }
@@ -1072,15 +1072,13 @@ static void add_join( dibdrv_physdev *pdev, HRGN region, const POINT *pt,
     return;
 }
 
-static HRGN get_wide_lines_region( dibdrv_physdev *pdev, int num, POINT *pts, BOOL close )
+static BOOL get_wide_lines_region( dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN total )
 {
     int i;
-    HRGN total, segment;
+    HRGN segment;
 
     assert( num >= 2 );
 
-    total = CreateRectRgn( 0, 0, 0, 0 );
-
     if (!close) num--;
     for (i = 0; i < num; i++)
     {
@@ -1223,14 +1221,15 @@ static HRGN get_wide_lines_region( dibdrv_physdev *pdev, int num, POINT *pts, BO
 
         prev_face = face_2;
     }
-    return total;
+    return TRUE;
 }
 
-static BOOL wide_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close)
+static BOOL wide_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
 {
-    HRGN region;
+    if (region) return get_wide_lines_region( pdev, num, pts, close, region );
 
-    region = get_wide_lines_region( pdev, num, pts, close );
+    if (!(region = CreateRectRgn( 0, 0, 0, 0 ))) return FALSE;
+    get_wide_lines_region( pdev, num, pts, close, region );
     if (pdev->clip) CombineRgn( region, region, pdev->clip, RGN_AND );
     pen_rect( pdev, NULL, region, GetROP2( pdev->dev.hdc ) );
     DeleteObject( region );




More information about the wine-cvs mailing list