Huw Davies : gdi32: Expose a solid_rects function.

Alexandre Julliard julliard at winehq.org
Mon Nov 14 13:33:59 CST 2011


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Nov 14 12:49:03 2011 +0000

gdi32: Expose a solid_rects function.

---

 dlls/gdi32/dibdrv/dibdrv.h  |    1 +
 dlls/gdi32/dibdrv/objects.c |   57 +++++++++++++++++++------------------------
 2 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h
index 93753aa..bb52156 100644
--- a/dlls/gdi32/dibdrv/dibdrv.h
+++ b/dlls/gdi32/dibdrv/dibdrv.h
@@ -211,6 +211,7 @@ extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HID
 extern BOOL convert_dib(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;
 extern DWORD get_pixel_color(dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup) DECLSPEC_HIDDEN;
 extern BOOL brush_rects( dibdrv_physdev *pdev, int num, const RECT *rects ) DECLSPEC_HIDDEN;
+extern void solid_rects( dib_info *dib, int num, const RECT *rects, const rop_mask *color, HRGN region ) DECLSPEC_HIDDEN;
 extern HRGN add_extra_clipping_region( dibdrv_physdev *pdev, HRGN rgn ) DECLSPEC_HIDDEN;
 extern void restore_clipping_region( dibdrv_physdev *pdev, HRGN rgn ) DECLSPEC_HIDDEN;
 extern int clip_line(const POINT *start, const POINT *end, const RECT *clip,
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index ddd3563..3de6cb9 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -1094,52 +1094,45 @@ COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
     return next->funcs->pSetDCPenColor( next, color );
 }
 
-/**********************************************************************
- *             solid_brush
- *
- * Fill a number of rectangles with the solid brush
- * FIXME: Should we insist l < r && t < b?  Currently we assume this.
- */
-static BOOL solid_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN region)
+void solid_rects( dib_info *dib, int num, const RECT *rects, const rop_mask *color, HRGN region )
 {
     int i, j;
-    const WINEREGION *clip = get_wine_region( region );
+    const WINEREGION *clip;
 
-    if (!clip)
+    if (!region)
     {
-        dib->funcs->solid_rects( dib, num, rects, pdev->brush_and, pdev->brush_xor );
-        return TRUE;
+        dib->funcs->solid_rects( dib, num, rects, color->and, color->xor );
+        return;
     }
 
+    clip = get_wine_region( region );
+
     for(i = 0; i < num; i++)
     {
         for(j = 0; j < clip->numRects; j++)
         {
-            RECT rect = rects[i];
+            RECT clipped_rect;
 
-            /* Optimize unclipped case */
-            if(clip->rects[j].top <= rect.top && clip->rects[j].bottom >= rect.bottom &&
-               clip->rects[j].left <= rect.left && clip->rects[j].right >= rect.right)
-            {
-                dib->funcs->solid_rects( dib, 1, &rect, pdev->brush_and, pdev->brush_xor );
-                break;
-            }
-
-            if(clip->rects[j].top >= rect.bottom) break;
-            if(clip->rects[j].bottom <= rect.top) continue;
-
-            if(clip->rects[j].right > rect.left && clip->rects[j].left < rect.right)
-            {
-                rect.left   = max(rect.left,   clip->rects[j].left);
-                rect.top    = max(rect.top,    clip->rects[j].top);
-                rect.right  = min(rect.right,  clip->rects[j].right);
-                rect.bottom = min(rect.bottom, clip->rects[j].bottom);
-
-                dib->funcs->solid_rects( dib, 1, &rect, pdev->brush_and, pdev->brush_xor );
-            }
+            if (intersect_rect( &clipped_rect, rects + i, clip->rects + j ))
+                dib->funcs->solid_rects( dib, 1, &clipped_rect, color->and, color->xor );
         }
     }
     release_wine_region( region );
+}
+
+/**********************************************************************
+ *             solid_brush
+ *
+ * Fill a number of rectangles with the solid brush
+ */
+static BOOL solid_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN region)
+{
+    rop_mask brush_color;
+
+    brush_color.and = pdev->brush_and;
+    brush_color.xor = pdev->brush_xor;
+
+    solid_rects( dib, num, rects, &brush_color, region );
     return TRUE;
 }
 




More information about the wine-cvs mailing list