Vincent Povirk : gdiplus: Account for gdi32 transform in GdipSetClipHrgn.
Alexandre Julliard
julliard at winehq.org
Tue Sep 5 15:18:51 CDT 2017
Module: wine
Branch: master
Commit: b32c3243782477f7cc6dc5a189a3e4a5dacce1c8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b32c3243782477f7cc6dc5a189a3e4a5dacce1c8
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Tue Sep 5 13:43:33 2017 -0500
gdiplus: Account for gdi32 transform in GdipSetClipHrgn.
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdiplus/graphics.c | 18 ++++++++++++-----
dlls/gdiplus/tests/graphics.c | 46 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 3b01505..ea02c6b 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -6209,6 +6209,7 @@ GpStatus WINGDIPAPI GdipSetClipHrgn(GpGraphics *graphics, HRGN hrgn, CombineMode
{
GpRegion *region;
GpStatus status;
+ GpMatrix transform;
TRACE("(%p, %p, %d)\n", graphics, hrgn, mode);
@@ -6218,14 +6219,21 @@ GpStatus WINGDIPAPI GdipSetClipHrgn(GpGraphics *graphics, HRGN hrgn, CombineMode
if(graphics->busy)
return ObjectBusy;
- /* hrgn is already in device units */
+ /* hrgn is in gdi32 device units */
status = GdipCreateRegionHrgn(hrgn, ®ion);
- if(status != Ok)
- return status;
- status = GdipCombineRegionRegion(graphics->clip, region, mode);
+ if (status == Ok)
+ {
+ status = get_graphics_transform(graphics, CoordinateSpaceDevice, WineCoordinateSpaceGdiDevice, &transform);
+
+ if (status == Ok)
+ status = GdipTransformRegion(region, &transform);
+
+ if (status == Ok)
+ status = GdipCombineRegionRegion(graphics->clip, region, mode);
- GdipDeleteRegion(region);
+ GdipDeleteRegion(region);
+ }
return status;
}
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 5416ebc..651ba53 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -6529,6 +6529,51 @@ static void test_GdipDrawImagePointsRectOnMemoryDC(void)
ReleaseDC(hwnd, dc);
}
+static void test_cliphrgn_transform(void)
+{
+ HDC hdc;
+ GpStatus status;
+ GpGraphics *graphics;
+ HRGN rgn;
+ RectF rectf;
+ BOOL res;
+
+ hdc = GetDC(hwnd);
+
+ SetViewportOrgEx(hdc, 10, 10, NULL);
+
+ status = GdipCreateFromHDC(hdc, &graphics);
+ expect(Ok, status);
+
+ rgn = CreateRectRgn(0, 0, 100, 100);
+
+ status = GdipSetClipHrgn(graphics, rgn, CombineModeReplace);
+ expect(Ok, status);
+
+ status = GdipGetVisibleClipBounds(graphics, &rectf);
+ expect(Ok, status);
+ expectf(-10.0, rectf.X);
+ expectf(-10.0, rectf.Y);
+ expectf(100.0, rectf.Width);
+ expectf(100.0, rectf.Height);
+
+ status = GdipIsVisiblePoint(graphics, 95, 95, &res);
+ expect(Ok, status);
+ expect(FALSE, res);
+
+ status = GdipIsVisiblePoint(graphics, -5, -5, &res);
+ expect(Ok, status);
+ expect(TRUE, res);
+
+ DeleteObject(rgn);
+
+ GdipDeleteGraphics(graphics);
+
+ SetViewportOrgEx(hdc, 0, 0, NULL);
+
+ ReleaseDC(hwnd, hdc);
+}
+
START_TEST(graphics)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -6618,6 +6663,7 @@ START_TEST(graphics)
test_GdipDrawImagePointsRectOnMemoryDC();
test_container_rects();
test_GdipGraphicsSetAbort();
+ test_cliphrgn_transform();
GdiplusShutdown(gdiplusToken);
DestroyWindow( hwnd );
More information about the wine-cvs
mailing list