Commit f9b881e3 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

gdiplus: Fix GdipGetVisibleClipBounds behavior on metafiles.

parent de37cedb
...@@ -2098,6 +2098,10 @@ static GpStatus get_visible_clip_region(GpGraphics *graphics, GpRegion *rgn) ...@@ -2098,6 +2098,10 @@ static GpStatus get_visible_clip_region(GpGraphics *graphics, GpRegion *rgn)
GpRectF rectf; GpRectF rectf;
GpRegion* tmp; GpRegion* tmp;
/* Ignore graphics image bounds for metafiles */
if (graphics->image && graphics->image_type == ImageTypeMetafile)
return GdipCombineRegionRegion(rgn, graphics->clip, CombineModeReplace);
if((stat = get_graphics_bounds(graphics, &rectf)) != Ok) if((stat = get_graphics_bounds(graphics, &rectf)) != Ok)
return stat; return stat;
......
...@@ -2117,6 +2117,7 @@ static void test_clipping(void) ...@@ -2117,6 +2117,7 @@ static void test_clipping(void)
GpGraphics *graphics; GpGraphics *graphics;
GpBitmap *bitmap; GpBitmap *bitmap;
GpBrush *brush; GpBrush *brush;
GpRectF rect;
ARGB color; ARGB color;
HDC hdc; HDC hdc;
static const GpRectF frame = {0.0, 0.0, 100.0, 100.0}; static const GpRectF frame = {0.0, 0.0, 100.0, 100.0};
...@@ -2140,9 +2141,23 @@ static void test_clipping(void) ...@@ -2140,9 +2141,23 @@ static void test_clipping(void)
stat = GdipSaveGraphics(graphics, &state); stat = GdipSaveGraphics(graphics, &state);
expect(Ok, stat); expect(Ok, stat);
stat = GdipGetVisibleClipBounds(graphics, &rect);
expect(Ok, stat);
ok(rect.X == -0x400000, "rect.X = %f\n", rect.X);
ok(rect.Y == -0x400000, "rect.Y = %f\n", rect.Y);
ok(rect.Width == 0x800000, "rect.Width = %f\n", rect.Width);
ok(rect.Height == 0x800000, "rect.Height = %f\n", rect.Height);
stat = GdipSetClipRect(graphics, 30, 30, 10, 10, CombineModeReplace); stat = GdipSetClipRect(graphics, 30, 30, 10, 10, CombineModeReplace);
expect(Ok, stat); expect(Ok, stat);
stat = GdipGetVisibleClipBounds(graphics, &rect);
expect(Ok, stat);
ok(rect.X == 30, "rect.X = %f\n", rect.X);
ok(rect.Y == 30, "rect.Y = %f\n", rect.Y);
ok(rect.Width == 10, "rect.Width = %f\n", rect.Width);
ok(rect.Height == 10, "rect.Height = %f\n", rect.Height);
stat = GdipCreateSolidFill((ARGB)0xff000000, (GpSolidFill**)&brush); stat = GdipCreateSolidFill((ARGB)0xff000000, (GpSolidFill**)&brush);
expect(Ok, stat); expect(Ok, stat);
......
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