Module: wine Branch: master Commit: bff1678f5495c8fc2c2d05202ad007f576df5904 URL: http://source.winehq.org/git/wine.git/?a=commit;h=bff1678f5495c8fc2c2d05202a...
Author: Nikolay Sivov bunglehead@gmail.com Date: Fri Sep 5 13:56:10 2008 +0400
gdiplus: Implemented GdipGraphicsClear.
---
dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/graphics.c | 35 +++++++++++++++++++++++++++++++++++ dlls/gdiplus/tests/graphics.c | 11 +++++++++++ include/gdiplusflat.h | 1 + 4 files changed, 48 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index e25ceb7..f7b1d5d 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -403,7 +403,7 @@ @ stub GdipGetVisibleClipBounds @ stub GdipGetVisibleClipBoundsI @ stdcall GdipGetWorldTransform(ptr ptr) -@ stub GdipGraphicsClear +@ stdcall GdipGraphicsClear(ptr long) @ stub GdipGraphicsSetAbort @ stub GdipImageForceValidation @ stdcall GdipImageGetFrameCount(ptr ptr ptr) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 1265bd7..b6cf090 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -2538,6 +2538,41 @@ GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix return Ok; }
+GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics *graphics, ARGB color) +{ + GpSolidFill *brush; + GpStatus stat; + RECT rect; + + TRACE("(%p, %x)\n", graphics, color); + + if(!graphics) + return InvalidParameter; + + if(graphics->busy) + return ObjectBusy; + + if((stat = GdipCreateSolidFill(color, &brush)) != Ok) + return stat; + + if(graphics->hwnd){ + if(!GetWindowRect(graphics->hwnd, &rect)){ + GdipDeleteBrush((GpBrush*)brush); + return GenericError; + } + + GdipFillRectangle(graphics, (GpBrush*)brush, 0.0, 0.0, (REAL)(rect.right - rect.left), + (REAL)(rect.bottom - rect.top)); + } + else + GdipFillRectangle(graphics, (GpBrush*)brush, 0.0, 0.0, (REAL)GetDeviceCaps(graphics->hdc, HORZRES), + (REAL)GetDeviceCaps(graphics->hdc, VERTRES)); + + GdipDeleteBrush((GpBrush*)brush); + + return Ok; +} + GpStatus WINGDIPAPI GdipIsClipEmpty(GpGraphics *graphics, BOOL *res) { TRACE("(%p, %p)\n", graphics, res); diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index d83f3b7..a011b91 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -672,6 +672,8 @@ static void test_Get_Release_DC(void) expect(ObjectBusy, status); status = Ok; status = GdipGetWorldTransform(graphics, m); expect(ObjectBusy, status); status = Ok; + status = GdipGraphicsClear(graphics, 0xdeadbeef); + expect(ObjectBusy, status); status = Ok; /* GdipMeasureCharacterRanges */ /* GdipMeasureString */ status = GdipResetClip(graphics); @@ -878,6 +880,14 @@ static void test_isempty(void) ReleaseDC(0, hdc); }
+static void test_clear(void) +{ + GpStatus status; + + status = GdipGraphicsClear(NULL, 0xdeadbeef); + expect(InvalidParameter, status); +} + START_TEST(graphics) { struct GdiplusStartupInput gdiplusStartupInput; @@ -901,6 +911,7 @@ START_TEST(graphics) test_transformpoints(); test_get_set_clip(); test_isempty(); + test_clear();
GdiplusShutdown(gdiplusToken); } diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index cbadd8b..cbb59e5 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -169,6 +169,7 @@ GpStatus WINGDIPAPI GdipGetPixelOffsetMode(GpGraphics*,PixelOffsetMode*); GpStatus WINGDIPAPI GdipGetSmoothingMode(GpGraphics*,SmoothingMode*); GpStatus WINGDIPAPI GdipGetTextRenderingHint(GpGraphics*,TextRenderingHint*); GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics*,GpMatrix*); +GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics*,ARGB); GpStatus WINGDIPAPI GdipMeasureString(GpGraphics*,GDIPCONST WCHAR*,INT, GDIPCONST GpFont*,GDIPCONST RectF*,GDIPCONST GpStringFormat*,RectF*,INT*,INT*); GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics*, GDIPCONST WCHAR*,