[11/17] gdiplus: associate a brush with a pen
Evan Stade
estade at gmail.com
Thu Jul 19 20:22:59 CDT 2007
Hi,
changelog:
*give each GpPen a GpBrush which is used to fill the line.
*update certain functions that have to recreate the GpPen's gdi pen
*store a logbrush in GpBrush to simplify cloning brushes and pens
dlls/gdiplus/brush.c | 4 ++++
dlls/gdiplus/gdiplus_private.h | 3 +++
dlls/gdiplus/pen.c | 27 ++++++---------------------
3 files changed, 13 insertions(+), 21 deletions(-)
--
Evan Stade
-------------- next part --------------
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(
*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 @@ #define __WINE_GP_PRIVATE_H_
#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 *
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
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
if(!pen) return InvalidParameter;
DeleteObject(pen->gdipen);
+ GdipDeleteBrush(pen->brush);
GdipDeleteCustomLineCap(pen->customstart);
GdipDeleteCustomLineCap(pen->customend);
GdipFree(pen);
@@ -182,8 +179,6 @@ GpStatus WINGDIPAPI GdipSetPenCustomStar
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
{
- LOGBRUSH lb;
-
if(!pen)
return InvalidParameter;
@@ -193,11 +188,7 @@ GpStatus WINGDIPAPI GdipSetPenDashStyle(
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 GdipSetPenLineCap197
* 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(G
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;
}
--
1.4.1
More information about the wine-patches
mailing list