Evan Stade : gdiplus: Associate a brush with a pen.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 20 06:02:35 CDT 2007


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

Author: Evan Stade <estade at gmail.com>
Date:   Thu Jul 19 18:22:59 2007 -0700

gdiplus: Associate a brush with a pen.

---

 dlls/gdiplus/brush.c           |    4 ++++
 dlls/gdiplus/gdiplus_private.h |    3 +++
 dlls/gdiplus/pen.c             |   27 ++++++---------------------
 3 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index 2a27fc8..b39df22 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -30,6 +30,10 @@ GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
     *sf = GdipAlloc(sizeof(GpSolidFill));
     if (!*sf) return OutOfMemory;
 
+    (*sf)->brush.lb.lbStyle = BS_SOLID;
+    (*sf)->brush.lb.lbColor = col;
+    (*sf)->brush.lb.lbHatch = 0;
+
     (*sf)->brush.gdibrush = CreateSolidBrush(col);
     (*sf)->brush.bt = BrushTypeSolidColor;
     (*sf)->brush.color = col;
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 206d86c..71cfe39 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -21,6 +21,7 @@
 
 #include <math.h>
 #include "windef.h"
+#include "wingdi.h"
 #include "gdiplus.h"
 
 #define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
@@ -54,6 +55,7 @@ struct GpPen{
     GpLineJoin join;
     REAL miterlimit;
     GpDashStyle dash;
+    GpBrush *brush;
 };
 
 struct GpGraphics{
@@ -69,6 +71,7 @@ struct GpBrush{
     HBRUSH gdibrush;
     GpBrushType bt;
     COLORREF color;
+    LOGBRUSH lb;
 };
 
 struct GpSolidFill{
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 9601f8c..da6a482 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -90,7 +90,6 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
 GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
     GpPen **pen)
 {
-    LOGBRUSH lb;
     GpPen *gp_pen;
 
     if(!pen)
@@ -107,14 +106,11 @@ GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
     gp_pen->join = LineJoinMiter;
     gp_pen->miterlimit = 10.0;
     gp_pen->dash = DashStyleSolid;
-
-    lb.lbStyle = BS_SOLID;
-    lb.lbColor = gp_pen->color;
-    lb.lbHatch = 0;
+    GdipCreateSolidFill(color, (GpSolidFill **)(&gp_pen->brush));
 
     if((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel)) {
-        gp_pen->gdipen = ExtCreatePen(gp_pen->style, (INT) gp_pen->width, &lb,
-            0, NULL);
+        gp_pen->gdipen = ExtCreatePen(gp_pen->style, (INT) gp_pen->width,
+                                      &gp_pen->brush->lb, 0, NULL);
     } else {
         FIXME("UnitWorld, UnitPixel only supported units\n");
         GdipFree(gp_pen);
@@ -131,6 +127,7 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
     if(!pen)    return InvalidParameter;
     DeleteObject(pen->gdipen);
 
+    GdipDeleteBrush(pen->brush);
     GdipDeleteCustomLineCap(pen->customstart);
     GdipDeleteCustomLineCap(pen->customend);
     GdipFree(pen);
@@ -182,8 +179,6 @@ GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* custom
 
 GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
 {
-    LOGBRUSH lb;
-
     if(!pen)
         return InvalidParameter;
 
@@ -193,11 +188,7 @@ GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
                     PS_DASHDOTDOT | PS_NULL | PS_USERSTYLE | PS_INSIDEFRAME);
     pen->style |= gdip_to_gdi_dash(dash);
 
-    lb.lbStyle = BS_SOLID;
-    lb.lbColor = pen->color;
-    lb.lbHatch = 0;
-
-    pen->gdipen = ExtCreatePen(pen->style, (INT) pen->width, &lb, 0, NULL);
+    pen->gdipen = ExtCreatePen(pen->style, (INT) pen->width, &pen->brush->lb, 0, NULL);
 
     return Ok;
 }
@@ -237,8 +228,6 @@ GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen *pen, GpLineCap start,
  * Both kinds of miter joins clip if the angle is less than 11 degrees. */
 GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen *pen, GpLineJoin join)
 {
-    LOGBRUSH lb;
-
     if(!pen)    return InvalidParameter;
 
     DeleteObject(pen->gdipen);
@@ -246,11 +235,7 @@ GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen *pen, GpLineJoin join)
     pen->style &= ~(PS_JOIN_ROUND | PS_JOIN_BEVEL | PS_JOIN_MITER);
     pen->style |= gdip_to_gdi_join(join);
 
-    lb.lbStyle = BS_SOLID;
-    lb.lbColor = pen->color;
-    lb.lbHatch = 0;
-
-    pen->gdipen = ExtCreatePen(pen->style, (INT) pen->width, &lb, 0, NULL);
+    pen->gdipen = ExtCreatePen(pen->style, (INT) pen->width, &pen->brush->lb, 0, NULL);
 
     return Ok;
 }




More information about the wine-cvs mailing list