+ HDC hcdc);
+\f
+/*
+ * Given device D, retrieve compatible device context. D can be either
+ * mswindows or an msprinter device.
+ */
+inline static HDC
+get_device_compdc (struct device *d)
+{
+ if (DEVICE_MSWINDOWS_P (d))
+ return DEVICE_MSWINDOWS_HCDC (d);
+ else
+ return DEVICE_MSPRINTER_HCDC (d);
+}
+
+/*
+ * Initialize image instance pixel sizes in II. For a display bitmap,
+ * these will be same as real bitmap sizes. For a printer bitmap,
+ * these will be scaled up so that the bitmap is proportionally enlarged
+ * when output to printer. Redisplay code takes care of scaling, to
+ * conserve memory we do not really scale bitmaps. Set the watermark
+ * only here.
+ * #### Add support for unscalable bitmaps.
+ */
+static void init_image_instance_geometry (Lisp_Image_Instance *ii)
+{
+ struct device *d = DOMAIN_XDEVICE (ii->domain);
+
+ if (/* #### Scaleable && */ DEVICE_MSPRINTER_P (d))
+ {
+ HDC printer_dc = DEVICE_MSPRINTER_HCDC (d);
+ HDC display_dc = CreateCompatibleDC (NULL);
+ IMAGE_INSTANCE_PIXMAP_WIDTH (ii) =
+ MulDiv (IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (ii),
+ GetDeviceCaps (printer_dc, LOGPIXELSX),
+ GetDeviceCaps (display_dc, LOGPIXELSX));
+ IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) =
+ MulDiv (IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (ii),
+ GetDeviceCaps (printer_dc, LOGPIXELSY),
+ GetDeviceCaps (display_dc, LOGPIXELSY));
+ }
+ else
+ {
+ IMAGE_INSTANCE_PIXMAP_WIDTH (ii) =
+ IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (ii);
+ IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) =
+ IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (ii);
+ }
+}