gdiplus: Don't require an HDC to get the resolution of a graphics object.

This commit is contained in:
Vincent Povirk 2010-08-08 15:53:08 -05:00 committed by Alexandre Julliard
parent c3ca6be2b9
commit 963c7090d5
1 changed files with 8 additions and 2 deletions

View File

@ -4574,7 +4574,10 @@ GpStatus WINGDIPAPI GdipGetDpiX(GpGraphics *graphics, REAL* dpi)
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
*dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSX); if (graphics->image)
*dpi = graphics->image->xres;
else
*dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSX);
return Ok; return Ok;
} }
@ -4589,7 +4592,10 @@ GpStatus WINGDIPAPI GdipGetDpiY(GpGraphics *graphics, REAL* dpi)
if(graphics->busy) if(graphics->busy)
return ObjectBusy; return ObjectBusy;
*dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSY); if (graphics->image)
*dpi = graphics->image->yres;
else
*dpi = (REAL)GetDeviceCaps(graphics->hdc, LOGPIXELSY);
return Ok; return Ok;
} }