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

gdiplus: Return visible clip bounds in world coordinates.

parent f42ff6fe
...@@ -4297,6 +4297,7 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect ...@@ -4297,6 +4297,7 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect
{ {
GpRegion *clip_rgn; GpRegion *clip_rgn;
GpStatus stat; GpStatus stat;
GpMatrix device_to_world;
TRACE("(%p, %p)\n", graphics, rect); TRACE("(%p, %p)\n", graphics, rect);
...@@ -4313,6 +4314,13 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect ...@@ -4313,6 +4314,13 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect
if((stat = get_visible_clip_region(graphics, clip_rgn)) != Ok) if((stat = get_visible_clip_region(graphics, clip_rgn)) != Ok)
goto cleanup; 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 */ /* get bounds of the region */
stat = GdipGetRegionBounds(clip_rgn, graphics, rect); stat = GdipGetRegionBounds(clip_rgn, graphics, rect);
......
...@@ -2313,6 +2313,29 @@ static void test_GdipGetVisibleClipBounds_window(void) ...@@ -2313,6 +2313,29 @@ static void test_GdipGetVisibleClipBounds_window(void)
recti.X, recti.Y, recti.Width, recti.Height, recti.X, recti.Y, recti.Width, recti.Height,
exp.X, exp.Y, exp.Width, exp.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); GdipDeleteGraphics(graphics);
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
} }
......
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