Commit b32c3243 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Account for gdi32 transform in GdipSetClipHrgn.

parent 9e1c1105
...@@ -6209,6 +6209,7 @@ GpStatus WINGDIPAPI GdipSetClipHrgn(GpGraphics *graphics, HRGN hrgn, CombineMode ...@@ -6209,6 +6209,7 @@ GpStatus WINGDIPAPI GdipSetClipHrgn(GpGraphics *graphics, HRGN hrgn, CombineMode
{ {
GpRegion *region; GpRegion *region;
GpStatus status; GpStatus status;
GpMatrix transform;
TRACE("(%p, %p, %d)\n", graphics, hrgn, mode); TRACE("(%p, %p, %d)\n", graphics, hrgn, mode);
...@@ -6218,14 +6219,21 @@ GpStatus WINGDIPAPI GdipSetClipHrgn(GpGraphics *graphics, HRGN hrgn, CombineMode ...@@ -6218,14 +6219,21 @@ GpStatus WINGDIPAPI GdipSetClipHrgn(GpGraphics *graphics, HRGN hrgn, CombineMode
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
/* hrgn is already in device units */ /* hrgn is in gdi32 device units */
status = GdipCreateRegionHrgn(hrgn, &region); status = GdipCreateRegionHrgn(hrgn, &region);
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; return status;
} }
......
...@@ -6529,6 +6529,51 @@ static void test_GdipDrawImagePointsRectOnMemoryDC(void) ...@@ -6529,6 +6529,51 @@ static void test_GdipDrawImagePointsRectOnMemoryDC(void)
ReleaseDC(hwnd, dc); 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) START_TEST(graphics)
{ {
struct GdiplusStartupInput gdiplusStartupInput; struct GdiplusStartupInput gdiplusStartupInput;
...@@ -6618,6 +6663,7 @@ START_TEST(graphics) ...@@ -6618,6 +6663,7 @@ START_TEST(graphics)
test_GdipDrawImagePointsRectOnMemoryDC(); test_GdipDrawImagePointsRectOnMemoryDC();
test_container_rects(); test_container_rects();
test_GdipGraphicsSetAbort(); test_GdipGraphicsSetAbort();
test_cliphrgn_transform();
GdiplusShutdown(gdiplusToken); GdiplusShutdown(gdiplusToken);
DestroyWindow( hwnd ); DestroyWindow( hwnd );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment