gdiplus: Fix graphics bounds for memory DC's.
This commit is contained in:
parent
81d9ffa041
commit
ba4ef584d7
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue