[6/10] gdiplus: implemented
GdipSetSolidFillColor/GdipGetSolidFillColor
Evan Stade
estade at gmail.com
Mon Jul 23 22:24:24 CDT 2007
Hi,
dlls/gdiplus/brush.c | 28 +++++++++++++++++++++-------
dlls/gdiplus/gdiplus_private.h | 2 +-
dlls/gdiplus/tests/pen.c | 3 +--
3 files changed, 23 insertions(+), 10 deletions(-)
--
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index 64fdb69..76456bd 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -26,12 +26,18 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBru
if(!brush || !clone)
return InvalidParameter;
- *clone = GdipAlloc(sizeof(GpBrush));
- if (!*clone) return OutOfMemory;
+ switch(brush->bt){
+ case BrushTypeSolidColor:
+ *clone = GdipAlloc(sizeof(GpSolidFill));
+ if (!*clone) return OutOfMemory;
- memcpy(*clone, brush, sizeof(GpBrush));
+ memcpy(*clone, brush, sizeof(GpSolidFill));
- (*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
+ (*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
+ break;
+ default:
+ return NotImplemented;
+ }
return Ok;
}
@@ -51,7 +57,7 @@ GpStatus WINGDIPAPI GdipCreateSolidFill(
(*sf)->brush.gdibrush = CreateSolidBrush(col);
(*sf)->brush.bt = BrushTypeSolidColor;
- (*sf)->brush.color = col;
+ (*sf)->color = color;
return Ok;
}
@@ -80,7 +86,9 @@ GpStatus WINGDIPAPI GdipGetSolidFillColo
if(!sf || !argb)
return InvalidParameter;
- return NotImplemented;
+ *argb = sf->color;
+
+ return Ok;
}
GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
@@ -88,5 +96,11 @@ GpStatus WINGDIPAPI GdipSetSolidFillColo
if(!sf)
return InvalidParameter;
- return NotImplemented;
+ sf->color = argb;
+ sf->brush.lb.lbColor = ARGB2COLORREF(argb);
+
+ DeleteObject(sf->brush.gdibrush);
+ sf->brush.gdibrush = CreateSolidBrush(sf->brush.lb.lbColor);
+
+ return Ok;
}
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index c872481..0338042 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -71,12 +71,12 @@ struct GpGraphics{
struct GpBrush{
HBRUSH gdibrush;
GpBrushType bt;
- COLORREF color;
LOGBRUSH lb;
};
struct GpSolidFill{
GpBrush brush;
+ ARGB color;
};
struct GpPath{
diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c
index 94163e9..16a9356 100644
--- a/dlls/gdiplus/tests/pen.c
+++ b/dlls/gdiplus/tests/pen.c
@@ -107,8 +107,7 @@ static void test_brushfill(void)
GdipGetPenBrushFill(pen, &brush2);
ok(brush != brush2, "Expected to get a clone, not a copy of the reference\n");
GdipGetSolidFillColor((GpSolidFill*)brush2, &color);
- todo_wine
- expect(0xabaddeed, color);
+ expect(0xabaddeed, color);
GdipDeleteBrush(brush);
GdipDeleteBrush(brush2);
--
1.4.1
More information about the wine-patches
mailing list