gdiplus: Don't require an HDC to get the resolution of a graphics object.
authorVincent Povirk <vincent@codeweavers.com>
Sun, 8 Aug 2010 20:53:08 +0000 (15:53 -0500)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 17 Aug 2010 09:55:33 +0000 (11:55 +0200)
dlls/gdiplus/graphics.c

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