diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index d5b562cacf0..a2ff33ff77f 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -2737,14 +2737,17 @@ GpStatus WINGDIPAPI GdipSetClipRectI(GpGraphics *graphics, INT x, INT y, } GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, - CombineMode combineMode) + CombineMode mode) { - static int calls; + TRACE("(%p, %p, %d)\n", graphics, region, mode); - if(!(calls++)) - FIXME("not implemented\n"); + if(!graphics || !region) + return InvalidParameter; - return NotImplemented; + if(graphics->busy) + return ObjectBusy; + + return GdipCombineRegionRegion(graphics->clip, region, mode); } GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile, diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index a468de9d9fd..e316ab96b3a 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -485,6 +485,7 @@ static void test_Get_Release_DC(void) GpPoint pt[5]; GpRectF rectf[2]; GpRect rect[2]; + GpRegion *clip; INT i; pt[0].X = 10; @@ -523,6 +524,7 @@ static void test_Get_Release_DC(void) GdipCreateRegion(®ion); GdipCreateSolidFill((ARGB)0xdeadbeef, &brush); GdipCreatePath(FillModeAlternate, &path); + GdipCreateRegion(&clip); status = GdipCreateFromHDC(hdc, &graphics); expect(Ok, status); @@ -702,7 +704,8 @@ static void test_Get_Release_DC(void) expect(ObjectBusy, status); status = Ok; status = GdipSetClipRectI(graphics, 0, 0, 10, 10, CombineModeReplace); expect(ObjectBusy, status); status = Ok; - /* GdipSetClipRegion */ + status = GdipSetClipRegion(graphics, clip, CombineModeReplace); + expect(ObjectBusy, status); status = GdipDrawPolygon(graphics, pen, ptf, 5); expect(ObjectBusy, status); status = Ok; status = GdipDrawPolygonI(graphics, pen, pt, 5); @@ -730,6 +733,7 @@ static void test_Get_Release_DC(void) GdipDeleteBrush((GpBrush*)brush); GdipDeleteRegion(region); GdipDeleteMatrix(m); + GdipDeleteRegion(region); ReleaseDC(0, hdc); } @@ -764,7 +768,7 @@ static void test_transformpoints(void) ReleaseDC(0, hdc); } -static void test_getclip(void) +static void test_get_set_clip(void) { GpStatus status; GpGraphics *graphics = NULL; @@ -789,6 +793,11 @@ static void test_getclip(void) status = GdipGetClip(NULL, clip); expect(InvalidParameter, status); + status = GdipSetClipRegion(NULL, NULL, CombineModeReplace); + expect(InvalidParameter, status); + status = GdipSetClipRegion(graphics, NULL, CombineModeReplace); + expect(InvalidParameter, status); + res = FALSE; status = GdipGetClip(graphics, clip); expect(Ok, status); @@ -823,7 +832,7 @@ START_TEST(graphics) test_GdipDrawLinesI(); test_Get_Release_DC(); test_transformpoints(); - test_getclip(); + test_get_set_clip(); GdiplusShutdown(gdiplusToken); } diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 3af06927559..ec72087399f 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -156,6 +156,7 @@ GpStatus WINGDIPAPI GdipFillRectangles(GpGraphics*,GpBrush*,GDIPCONST GpRectF*,I GpStatus WINGDIPAPI GdipFillRectanglesI(GpGraphics*,GpBrush*,GDIPCONST GpRect*,INT); GpStatus WINGDIPAPI GdipGetCompositingMode(GpGraphics*,CompositingMode*); GpStatus WINGDIPAPI GdipGetClip(GpGraphics*,GpRegion*); +GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics*,GpRegion*,CombineMode); GpStatus WINGDIPAPI GdipGetCompositingQuality(GpGraphics*,CompositingQuality*); GpStatus WINGDIPAPI GdipGetDC(GpGraphics*,HDC*); GpStatus WINGDIPAPI GdipGetImageDimension(GpImage*,REAL*,REAL*);