[4/4] gdiplus: Fix graphics bounds for memory DC's.
Vincent Povirk
madewokherd at gmail.com
Wed Dec 5 14:21:03 CST 2012
-------------- next part --------------
From 929d88878319bd8ed6b17b0d43d17931aae661a3 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Wed, 5 Dec 2012 14:11:25 -0600
Subject: [PATCH 4/4] gdiplus: Fix graphics bounds for memory DC's.
---
dlls/gdiplus/graphics.c | 19 +++++++++++++++++++
dlls/gdiplus/tests/graphics.c | 8 ++++++++
2 files changed, 27 insertions(+)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 4474db6..8cec80d 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 f4e7ffa..42612dd 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);
--
1.7.10.4
More information about the wine-patches
mailing list