[1/4] gdiplus: added rendering of fill-path type custom line caps

Evan Stade estade at gmail.com
Fri Jul 20 19:50:02 CDT 2007


Hi,

 dlls/gdiplus/customlinecap.c |    7 +++++++
 dlls/gdiplus/graphics.c      |   20 ++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)
-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/customlinecap.c b/dlls/gdiplus/customlinecap.c
index 76e2c1d..aadea5f 100644
--- a/dlls/gdiplus/customlinecap.c
+++ b/dlls/gdiplus/customlinecap.c
@@ -23,6 +23,9 @@ #include "winbase.h"
 
 #include "gdiplus.h"
 #include "gdiplus_private.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
 
 GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from,
     GpCustomLineCap** to)
@@ -52,11 +55,15 @@ GpStatus WINGDIPAPI GdipCloneCustomLineC
     return Ok;
 }
 
+/* FIXME: Sometimes when fillPath is non-null and stroke path is null, the native
+ * version of this function returns NotImplemented. I cannot figure out why. */
 GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath,
     GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap)
 {
     GpPathData *pathdata;
 
+    TRACE("%p %p %d %f %p\n", fillPath, strokePath, baseCap, baseInset, customCap);
+
     if(!customCap || !(fillPath || strokePath))
         return InvalidParameter;
 
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 4a581d1..a7383ab 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -130,7 +130,8 @@ static void calc_curve_bezier_endp(REAL 
 }
 
 /* Draws the linecap the specified color and size on the hdc.  The linecap is in
- * direction of the line from x1, y1 to x2, y2 and is anchored on x2, y2. */
+ * direction of the line from x1, y1 to x2, y2 and is anchored on x2, y2. Probably
+ * should not be called on an hdc that has a path you care about. */
 static void draw_cap(HDC hdc, COLORREF color, GpLineCap cap, REAL size,
     const GpCustomLineCap *custom, REAL x1, REAL y1, REAL x2, REAL y2)
 {
@@ -158,7 +159,8 @@ static void draw_cap(HDC hdc, COLORREF c
     lb.lbColor = color;
     lb.lbHatch = 0;
     pen = ExtCreatePen(PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT,
-                       (cap == LineCapCustom ? size : 1), &lb, 0, NULL);
+               ((cap == LineCapCustom) && custom && (custom->fill)) ? size : 1,
+               &lb, 0, NULL);
     oldbrush = SelectObject(hdc, brush);
     oldpen = SelectObject(hdc, pen);
 
@@ -267,11 +269,6 @@ static void draw_cap(HDC hdc, COLORREF c
             if(!custom)
                 break;
 
-            if(custom->fill){
-                FIXME("fill-path custom line caps not implemented\n");
-                break;
-            }
-
             count = custom->pathdata.Count;
             custptf = GdipAlloc(count * sizeof(PointF));
             custpt = GdipAlloc(count * sizeof(POINT));
@@ -294,7 +291,14 @@ static void draw_cap(HDC hdc, COLORREF c
                 tp[i] = convert_path_point_type(custom->pathdata.Types[i]);
             }
 
-            PolyDraw(hdc, custpt, tp, count);
+            if(custom->fill){
+                BeginPath(hdc);
+                PolyDraw(hdc, custpt, tp, count);
+                EndPath(hdc);
+                StrokeAndFillPath(hdc);
+            }
+            else
+                PolyDraw(hdc, custpt, tp, count);
 
 custend:
             GdipFree(custptf);
-- 
1.4.1


More information about the wine-patches mailing list