Changhui Liu : gdiplus: Fix get_graphics_bounds when window origin point changed.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jan 19 16:00:08 CST 2015
Module: wine
Branch: master
Commit: 5fa7402a36ee0e1238434598ff589e3de42f80cd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5fa7402a36ee0e1238434598ff589e3de42f80cd
Author: Changhui Liu <liuchanghui at linuxdeepin.com>
Date: Mon Dec 22 16:43:47 2014 +0800
gdiplus: Fix get_graphics_bounds when window origin point changed.
---
dlls/gdiplus/graphics.c | 3 +--
dlls/gdiplus/tests/graphics.c | 56 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 840d866..68a4ee5 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -2029,8 +2029,7 @@ static GpStatus get_graphics_bounds(GpGraphics* graphics, GpRectF* rect)
rect->Height = GetDeviceCaps(graphics->hdc, VERTRES);
}
- if (graphics->hdc &&
- (GetMapMode(graphics->hdc) != MM_TEXT || GetGraphicsMode(graphics->hdc) != GM_COMPATIBLE))
+ if (graphics->hdc)
{
POINT points[2];
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 8ce372b..fd4cf80 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -5548,6 +5548,61 @@ static void test_GdipFillRectangles(void)
ReleaseDC(hwnd, hdc);
}
+static void test_GdipGetVisibleClipBounds_memoryDC(void)
+{
+ HDC hdc,dc;
+ HBITMAP bmp;
+ HGDIOBJ old;
+ RECT rect;
+ POINT pt;
+ int width = 0;
+ int height = 0;
+ GpGraphics* graphics = NULL;
+ GpRect boundRect;
+ GpStatus status;
+
+ ok(GetClientRect(hwnd, &rect), "GetClientRect should have succeeded\n");
+ width = rect.right - rect.left;
+ height = rect.bottom - rect.top;
+
+ dc = GetDC(hwnd);
+ hdc = CreateCompatibleDC ( dc );
+ bmp = CreateCompatibleBitmap ( dc, width, height );
+ old = SelectObject (hdc, bmp);
+
+ /*change the window origin is the key test point*/
+ SetWindowOrgEx (hdc, rect.left+10, rect.top+10, &pt);
+
+ status = GdipCreateFromHDC(hdc, &graphics);
+ expect(Ok, status);
+
+ status = GdipGetVisibleClipBoundsI(graphics, &boundRect);
+ expect(Ok, status);
+
+ ok(boundRect.X==rect.left+10 &&
+ boundRect.Y==rect.top+10 &&
+ boundRect.Width==width &&
+ boundRect.Height==height, "Expected GdipGetVisibleClipBoundsI ok\n");
+
+ status = GdipSetClipRectI(graphics, 0, 0, width, height, CombineModeReplace);
+ expect(Ok, status);
+
+ status = GdipGetVisibleClipBoundsI(graphics, &boundRect);
+ expect(Ok, status);
+
+ ok(boundRect.X==rect.left+10 &&
+ boundRect.Y==rect.top+10 &&
+ boundRect.Width==width-10 &&
+ boundRect.Height==height-10, "Expected GdipGetVisibleClipBoundsI ok\n");
+
+ GdipDeleteGraphics(graphics);
+
+ SelectObject (hdc, old);
+ DeleteObject (bmp);
+ DeleteDC (hdc);
+ ReleaseDC(hwnd, dc);
+}
+
START_TEST(graphics)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -5619,6 +5674,7 @@ START_TEST(graphics)
test_alpha_hdc();
test_bitmapfromgraphics();
test_GdipFillRectangles();
+ test_GdipGetVisibleClipBounds_memoryDC();
GdiplusShutdown(gdiplusToken);
DestroyWindow( hwnd );
More information about the wine-cvs
mailing list