gdiplus: Fix GdipGetVisibleClipBounds behavior on metafiles.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2017-07-13 11:54:06 +02:00 committed by Alexandre Julliard
parent de37cedb70
commit f9b881e30c
2 changed files with 19 additions and 0 deletions

View File

@ -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;

View File

@ -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)
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);