Commit 5fa7402a authored by Changhui Liu's avatar Changhui Liu Committed by Alexandre Julliard

gdiplus: Fix get_graphics_bounds when window origin point changed.

parent da8bb1c4
......@@ -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];
......
......@@ -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 );
......
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