diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index dac52efea3c..83538090a23 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -4297,6 +4297,7 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect { GpRegion *clip_rgn; GpStatus stat; + GpMatrix device_to_world; TRACE("(%p, %p)\n", graphics, rect); @@ -4313,6 +4314,13 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect if((stat = get_visible_clip_region(graphics, clip_rgn)) != Ok) goto cleanup; + /* transform to world coordinates */ + if((stat = get_graphics_transform(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, &device_to_world)) != Ok) + goto cleanup; + + if((stat = GdipTransformRegion(clip_rgn, &device_to_world)) != Ok) + goto cleanup; + /* get bounds of the region */ stat = GdipGetRegionBounds(clip_rgn, graphics, rect); diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 3ee3363d017..cf5652b8d28 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -2313,6 +2313,29 @@ static void test_GdipGetVisibleClipBounds_window(void) recti.X, recti.Y, recti.Width, recti.Height, exp.X, exp.Y, exp.Width, exp.Height); + /* window bounds with transform applied */ + status = GdipResetClip(graphics); + expect(Ok, status); + + status = GdipScaleWorldTransform(graphics, 0.5, 0.5, MatrixOrderPrepend); + expect(Ok, status); + + exp.X = window.X * 2.0; + exp.Y = window.Y * 2.0; + exp.Width = window.Width * 2.0; + exp.Height = window.Height * 2.0; + + status = GdipGetVisibleClipBounds(graphics, &rectf); + expect(Ok, status); + ok(rectf.X == exp.X && + rectf.Y == exp.Y && + rectf.Width == exp.Width && + rectf.Height == exp.Height, + "Expected clip bounds (%0.f, %0.f, %0.f, %0.f) to be " + "twice the window size (%0.f, %0.f, %0.f, %0.f)\n", + rectf.X, rectf.Y, rectf.Width, rectf.Height, + exp.X, exp.Y, exp.Width, exp.Height); + GdipDeleteGraphics(graphics); EndPaint(hwnd, &ps); }