diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 4474db60001..8cec80d1a6a 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -2113,6 +2113,25 @@ static GpStatus get_graphics_bounds(GpGraphics* graphics, GpRectF* rect) stat = GdipGetImageBounds(graphics->image, rect, &unit); if (stat == Ok && unit != UnitPixel) FIXME("need to convert from unit %i\n", unit); + }else if (GetObjectType(graphics->hdc) == OBJ_MEMDC){ + HBITMAP hbmp; + BITMAP bmp; + + rect->X = 0; + rect->Y = 0; + + hbmp = GetCurrentObject(graphics->hdc, OBJ_BITMAP); + if (hbmp && GetObjectW(hbmp, sizeof(bmp), &bmp)) + { + rect->Width = bmp.bmWidth; + rect->Height = bmp.bmHeight; + } + else + { + /* FIXME: ??? */ + rect->Width = 1; + rect->Height = 1; + } }else{ rect->X = 0; rect->Y = 0; diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index f4e7ffaa0d7..42612dd52d6 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -4091,6 +4091,7 @@ static void test_alpha_hdc(void) GpGraphics *graphics; ULONG *bits; BITMAPINFO bmi; + GpRectF bounds; hdc = CreateCompatibleDC(0); ok(hdc != NULL, "CreateCompatibleDC failed\n"); @@ -4110,6 +4111,13 @@ static void test_alpha_hdc(void) status = GdipCreateFromHDC(hdc, &graphics); expect(Ok, status); + status = GdipGetVisibleClipBounds(graphics, &bounds); + expect(Ok, status); + expectf(0.0, bounds.X); + expectf(0.0, bounds.Y); + expectf(5.0, bounds.Width); + expectf(5.0, bounds.Height); + bits[0] = 0xdeadbeef; status = GdipGraphicsClear(graphics, 0xffaaaaaa);