From 8d9c4867aed0a6cac2a8f8fc15d95c7d9c85ed72 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 25 Sep 2008 10:41:15 +0400 Subject: [PATCH] gdiplus: Implemented GdipSetClipRect/GdipSetClipRectI. --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/graphics.c | 33 ++++++++++++++++++++++++++------- dlls/gdiplus/tests/graphics.c | 2 ++ include/gdiplusflat.h | 1 + 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 1fe0c8eebb4..0faf01beb93 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -509,7 +509,7 @@ @ stub GdipSetClipGraphics @ stub GdipSetClipHrgn @ stub GdipSetClipPath -@ stub GdipSetClipRect +@ stdcall GdipSetClipRect(ptr long long long long long) @ stdcall GdipSetClipRectI(ptr long long long long long) @ stdcall GdipSetClipRegion(ptr ptr long) @ stdcall GdipSetCompositingMode(ptr long) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 3689fd3d8bb..b36e31c4b13 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -2948,11 +2948,13 @@ GpStatus WINGDIPAPI GdipTranslateWorldTransform(GpGraphics *graphics, REAL dx, return GdipTranslateMatrix(graphics->worldtrans, dx, dy, order); } -GpStatus WINGDIPAPI GdipSetClipRectI(GpGraphics *graphics, INT x, INT y, - INT width, INT height, - CombineMode combineMode) +GpStatus WINGDIPAPI GdipSetClipRect(GpGraphics *graphics, REAL x, REAL y, + REAL width, REAL height, + CombineMode mode) { - static int calls; + GpRectF rect; + + TRACE("(%p, %.2f, %.2f, %.2f, %.2f, %d)\n", graphics, x, y, width, height, mode); if(!graphics) return InvalidParameter; @@ -2960,10 +2962,27 @@ GpStatus WINGDIPAPI GdipSetClipRectI(GpGraphics *graphics, INT x, INT y, if(graphics->busy) return ObjectBusy; - if(!(calls++)) - FIXME("not implemented\n"); + rect.X = x; + rect.Y = y; + rect.Width = width; + rect.Height = height; - return NotImplemented; + return GdipCombineRegionRect(graphics->clip, &rect, mode); +} + +GpStatus WINGDIPAPI GdipSetClipRectI(GpGraphics *graphics, INT x, INT y, + INT width, INT height, + CombineMode mode) +{ + TRACE("(%p, %d, %d, %d, %d, %d)\n", graphics, x, y, width, height, mode); + + if(!graphics) + return InvalidParameter; + + if(graphics->busy) + return ObjectBusy; + + return GdipSetClipRect(graphics, (REAL)x, (REAL)y, (REAL)width, (REAL)height, mode); } GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index a011b9132fb..c000843525c 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -706,6 +706,8 @@ static void test_Get_Release_DC(void) expect(ObjectBusy, status); status = Ok; status = GdipTranslateWorldTransform(graphics, 0.0, 0.0, MatrixOrderPrepend); expect(ObjectBusy, status); status = Ok; + status = GdipSetClipRect(graphics, 0.0, 0.0, 10.0, 10.0, CombineModeReplace); + expect(ObjectBusy, status); status = Ok; status = GdipSetClipRectI(graphics, 0, 0, 10, 10, CombineModeReplace); expect(ObjectBusy, status); status = Ok; status = GdipSetClipRegion(graphics, clip, CombineModeReplace); diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index a888f90d49a..efef67ce8af 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -533,6 +533,7 @@ GpStatus WINGDIPAPI GdipTranslateRegionI(GpRegion *, INT, INT); GpStatus WINGDIPAPI GdipFlush(GpGraphics*, GpFlushIntention); GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile*,UINT); +GpStatus WINGDIPAPI GdipSetClipRect(GpGraphics*,REAL,REAL,REAL,REAL,CombineMode); GpStatus WINGDIPAPI GdipSetClipRectI(GpGraphics*,INT,INT,INT,INT,CombineMode); GpStatus WINGDIPAPI GdipFillRegion(GpGraphics*,GpBrush*,GpRegion*);