-#else
- MoveToEx (hdc, points[0].x, points[0].y, NULL);
- for (i = 1; i < npoints; i++)
- if (!LineTo (hdc, points[i].x, points[i].y))
- WIN32_GDI_FAILED ("LineTo");
-
- /* Draw end pixel */
- /* LineTo doesn't draw the last point, so if we have a pen width of 1,
- * we draw the end pixel separately... With wider pens we don't care.
- * //HB: But the NT developers don't read their API documentation ...
- */
- if (gc_data->pen_width <= 1 && windows_version > 0x80000000)
- if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y))
- WIN32_GDI_FAILED ("LineTo");
-#endif
- gdk_gc_postdraw (drawable, gc_private, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND);
+ gdk_gc_postdraw (drawable, gc_private, mask);
+}
+
+static void
+gdk_win32_draw_glyphs (GdkDrawable *drawable,
+ GdkGC *gc,
+ PangoFont *font,
+ gint x,
+ gint y,
+ PangoGlyphString *glyphs)
+{
+ GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
+ GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
+ const GdkGCValuesMask mask = GDK_GC_FOREGROUND;
+ HDC hdc;
+
+ hdc = gdk_gc_predraw (drawable, gc_private, mask);
+
+ pango_win32_render (hdc, font, glyphs, x, y);
+
+ gdk_gc_postdraw (drawable, gc_private, mask);
+}
+
+static void
+gdk_win32_draw_image (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
+{
+ GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
+ GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
+ GdkImagePrivateWin32 *image_private = (GdkImagePrivateWin32 *) image;
+ GdkColormapPrivateWin32 *colormap_private = (GdkColormapPrivateWin32 *) impl->colormap;
+ HDC hdc, memdc;
+ HGDIOBJ oldbitmap;
+ DIBSECTION ds;
+ static struct {
+ BITMAPINFOHEADER bmiHeader;
+ WORD bmiIndices[256];
+ } bmi;
+ static gboolean bmi_inited = FALSE;
+ gboolean ok = TRUE;
+ int i;
+
+ hdc = gdk_gc_predraw (drawable, gc_private, 0);
+
+ if (colormap_private && colormap_private->xcolormap->rc_palette)
+ {
+ if (!bmi_inited)
+ {
+ for (i = 0; i < 256; i++)
+ bmi.bmiIndices[i] = i;
+ bmi_inited = TRUE;
+ }
+
+ if (GetObject (image_private->hbitmap, sizeof (DIBSECTION),
+ &ds) != sizeof (DIBSECTION))
+ WIN32_GDI_FAILED ("GetObject"), ok = FALSE;
+#if 0
+ g_print("xdest = %d, ydest = %d, xsrc = %d, ysrc = %d, width = %d, height = %d\n",
+ xdest, ydest, xsrc, ysrc, width, height);
+ g_print("bmWidth = %d, bmHeight = %d, bmBitsPixel = %d, bmBits = %p\n",
+ ds.dsBm.bmWidth, ds.dsBm.bmHeight, ds.dsBm.bmBitsPixel, ds.dsBm.bmBits);
+ g_print("biWidth = %d, biHeight = %d, biBitCount = %d, biClrUsed = %d\n",
+ ds.dsBmih.biWidth, ds.dsBmih.biHeight, ds.dsBmih.biBitCount, ds.dsBmih.biClrUsed);
+#endif
+ bmi.bmiHeader = ds.dsBmih;
+ /* I have spent hours on getting the parameters to
+ * SetDIBitsToDevice right. I wonder what drugs the guys in
+ * Redmond were on when they designed this API.
+ */
+ if (ok && SetDIBitsToDevice (hdc,
+ xdest, ydest,
+ width, height,
+ xsrc, (-ds.dsBmih.biHeight)-height-ysrc,
+ 0, -ds.dsBmih.biHeight,
+ ds.dsBm.bmBits,
+ (CONST BITMAPINFO *) &bmi,
+ DIB_PAL_COLORS) == 0)
+ WIN32_GDI_FAILED ("SetDIBitsToDevice");
+ }
+ else
+ {
+
+ if ((memdc = CreateCompatibleDC (hdc)) == NULL)
+ WIN32_GDI_FAILED ("CreateCompatibleDC"), ok = FALSE;
+
+ if (ok && (oldbitmap = SelectObject (memdc, image_private->hbitmap)) == NULL)
+ WIN32_GDI_FAILED ("SelectObject"), ok = FALSE;
+
+ if (ok && !BitBlt (hdc, xdest, ydest, width, height,
+ memdc, xsrc, ysrc, SRCCOPY))
+ WIN32_GDI_FAILED ("BitBlt");
+
+ if (oldbitmap != NULL && SelectObject (memdc, oldbitmap) == NULL)
+ WIN32_GDI_FAILED ("SelectObject");
+
+ if (memdc != NULL && !DeleteDC (memdc))
+ WIN32_GDI_FAILED ("DeleteDC");
+ }
+ gdk_gc_postdraw (drawable, gc_private, 0);
+}
+
+static gint
+gdk_win32_get_depth (GdkDrawable *drawable)
+{
+ /* This is a bit bogus but I'm not sure the other way is better */
+
+ return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_WIN32 (drawable)->wrapper);