+/*
+ * 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)
+{
+ Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
+ struct device *d = XDEVICE (device);
+
+ 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);
+ }
+}