Module: wine Branch: master Commit: 8b2ce0f94b2097fdcafc6f313b56858a45d2990a URL: http://source.winehq.org/git/wine.git/?a=commit;h=8b2ce0f94b2097fdcafc6f313b... Author: Evan Stade <estade(a)gmail.com> Date: Mon Jul 23 20:24:24 2007 -0700 gdiplus: Implemented GdipSetSolidFillColor/GdipGetSolidFillColor. --- dlls/gdiplus/brush.c | 28 +++++++++++++++++++++------- dlls/gdiplus/gdiplus_private.h | 2 +- dlls/gdiplus/tests/pen.c | 3 +-- 3 files changed, 23 insertions(+), 10 deletions(-) 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(GpBrush *brush, GpBrush **clone) 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(ARGB color, GpSolidFill **sf) (*sf)->brush.gdibrush = CreateSolidBrush(col); (*sf)->brush.bt = BrushTypeSolidColor; - (*sf)->brush.color = col; + (*sf)->color = color; return Ok; } @@ -80,7 +86,9 @@ GpStatus WINGDIPAPI GdipGetSolidFillColor(GpSolidFill *sf, ARGB *argb) 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 GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb) 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);