diff --git a/ChangeLog b/ChangeLog index 1e64178527..ba36279e8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2002-12-01 Tor Lillqvist + + * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak + stipple_gc. Some more checks for errors. Use correct ternary ROP + when blitting the foreground into the tile pixmap where the + stipple is set. (I didn't notice that I had used the wrong one, as + it didn't matter on Win2k, where DIB sections apparently are + zeroed upon creation. But on Win98 they have random initial + contents. Thanks to Hans Breuer for reporting this.) + (gdk_win32_draw_rectangle, gdk_win32_draw_arc, + gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to + generic_draw() if drawing a filled figure. + + * gdk/win32/gdkmain-win32.c (gdk_win32_print_dc): Minor cosmetics. + (gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty. + 2002-11-29 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (WIN32_API_FAILED, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 1e64178527..ba36279e8c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,19 @@ +2002-12-01 Tor Lillqvist + + * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak + stipple_gc. Some more checks for errors. Use correct ternary ROP + when blitting the foreground into the tile pixmap where the + stipple is set. (I didn't notice that I had used the wrong one, as + it didn't matter on Win2k, where DIB sections apparently are + zeroed upon creation. But on Win98 they have random initial + contents. Thanks to Hans Breuer for reporting this.) + (gdk_win32_draw_rectangle, gdk_win32_draw_arc, + gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to + generic_draw() if drawing a filled figure. + + * gdk/win32/gdkmain-win32.c (gdk_win32_print_dc): Minor cosmetics. + (gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty. + 2002-11-29 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (WIN32_API_FAILED, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 1e64178527..ba36279e8c 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,19 @@ +2002-12-01 Tor Lillqvist + + * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak + stipple_gc. Some more checks for errors. Use correct ternary ROP + when blitting the foreground into the tile pixmap where the + stipple is set. (I didn't notice that I had used the wrong one, as + it didn't matter on Win2k, where DIB sections apparently are + zeroed upon creation. But on Win98 they have random initial + contents. Thanks to Hans Breuer for reporting this.) + (gdk_win32_draw_rectangle, gdk_win32_draw_arc, + gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to + generic_draw() if drawing a filled figure. + + * gdk/win32/gdkmain-win32.c (gdk_win32_print_dc): Minor cosmetics. + (gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty. + 2002-11-29 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (WIN32_API_FAILED, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 1e64178527..ba36279e8c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,19 @@ +2002-12-01 Tor Lillqvist + + * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak + stipple_gc. Some more checks for errors. Use correct ternary ROP + when blitting the foreground into the tile pixmap where the + stipple is set. (I didn't notice that I had used the wrong one, as + it didn't matter on Win2k, where DIB sections apparently are + zeroed upon creation. But on Win98 they have random initial + contents. Thanks to Hans Breuer for reporting this.) + (gdk_win32_draw_rectangle, gdk_win32_draw_arc, + gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to + generic_draw() if drawing a filled figure. + + * gdk/win32/gdkmain-win32.c (gdk_win32_print_dc): Minor cosmetics. + (gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty. + 2002-11-29 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (WIN32_API_FAILED, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 1e64178527..ba36279e8c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,19 @@ +2002-12-01 Tor Lillqvist + + * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak + stipple_gc. Some more checks for errors. Use correct ternary ROP + when blitting the foreground into the tile pixmap where the + stipple is set. (I didn't notice that I had used the wrong one, as + it didn't matter on Win2k, where DIB sections apparently are + zeroed upon creation. But on Win98 they have random initial + contents. Thanks to Hans Breuer for reporting this.) + (gdk_win32_draw_rectangle, gdk_win32_draw_arc, + gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to + generic_draw() if drawing a filled figure. + + * gdk/win32/gdkmain-win32.c (gdk_win32_print_dc): Minor cosmetics. + (gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty. + 2002-11-29 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (WIN32_API_FAILED, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 1e64178527..ba36279e8c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,19 @@ +2002-12-01 Tor Lillqvist + + * gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak + stipple_gc. Some more checks for errors. Use correct ternary ROP + when blitting the foreground into the tile pixmap where the + stipple is set. (I didn't notice that I had used the wrong one, as + it didn't matter on Win2k, where DIB sections apparently are + zeroed upon creation. But on Win98 they have random initial + contents. Thanks to Hans Breuer for reporting this.) + (gdk_win32_draw_rectangle, gdk_win32_draw_arc, + gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to + generic_draw() if drawing a filled figure. + + * gdk/win32/gdkmain-win32.c (gdk_win32_print_dc): Minor cosmetics. + (gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty. + 2002-11-29 Tor Lillqvist * gdk/win32/gdkprivate-win32.h (WIN32_API_FAILED, diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 89eed71a82..462af4575b 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -35,8 +35,8 @@ #include "gdkregion-generic.h" #define ROP3_D 0x00AA0029 -#define ROP3_DPSao 0x00EA02E9 #define ROP3_DSna 0x00220326 +#define ROP3_DSPDxax 0x00E20746 #define LINE_ATTRIBUTES (GDK_GC_LINE_WIDTH|GDK_GC_LINE_STYLE| \ GDK_GC_CAP_STYLE|GDK_GC_JOIN_STYLE) @@ -531,6 +531,7 @@ generic_draw (GdkDrawable *drawable, gdk_draw_rectangle (tile_pixmap, tile_gc, TRUE, 0, 0, width, height); } + gdk_gc_unref (stipple_gc); } gdk_gc_unref (mask_gc); @@ -547,19 +548,49 @@ generic_draw (GdkDrawable *drawable, if (gcwin32->fill_style == GDK_STIPPLED || gcwin32->fill_style == GDK_OPAQUE_STIPPLED) { - HDC stipple_hdc = CreateCompatibleDC (hdc); - HGDIOBJ old_stipple_hbm = SelectObject (stipple_hdc, GDK_PIXMAP_HBITMAP (stipple_bitmap)); - HBRUSH fg_brush = CreateSolidBrush - (_gdk_win32_colormap_color (impl->colormap, gcwin32->foreground)); - HGDIOBJ old_tile_brush = SelectObject (tile_hdc, fg_brush); + HDC stipple_hdc; + HGDIOBJ old_stipple_hbm; + HBRUSH fg_brush; + HGDIOBJ old_tile_brush; - /* Paint tile with foreround where stipple is one */ + if ((stipple_hdc = CreateCompatibleDC (hdc)) == NULL) + WIN32_GDI_FAILED ("CreateCompatibleDC"); + + if ((old_stipple_hbm = + SelectObject (stipple_hdc, + GDK_PIXMAP_HBITMAP (stipple_bitmap))) == NULL) + WIN32_GDI_FAILED ("SelectObject"); + + if ((fg_brush = CreateSolidBrush + (_gdk_win32_colormap_color (impl->colormap, + gcwin32->foreground))) == NULL) + WIN32_GDI_FAILED ("CreateSolidBrush"); + + if ((old_tile_brush = SelectObject (tile_hdc, fg_brush)) == NULL) + WIN32_GDI_FAILED ("SelectObject"); + + /* Paint tile with foreround where stipple is one + * + * Desired ternary ROP: (P=foreground, S=stipple, D=destination) + * P S D ? + * 0 0 0 0 + * 0 0 1 1 + * 0 1 0 0 + * 0 1 1 0 + * 1 0 0 0 + * 1 0 1 1 + * 1 1 0 1 + * 1 1 1 1 + * + * Reading bottom-up: 11100010 = 0xE2. PSDK docs say this is + * known as DSPDxax, with hex value 0x00E20746. + */ GDI_CALL (BitBlt, (tile_hdc, 0, 0, width, height, - stipple_hdc, 0, 0, ROP3_DPSao)); + stipple_hdc, 0, 0, ROP3_DSPDxax)); if (gcwin32->fill_style == GDK_STIPPLED) { - /* Punch holes in mask where stipple bitmap is zero */ + /* Punch holes in mask where stipple is zero */ GDI_CALL (BitBlt, (mask_hdc, 0, 0, width, height, stipple_hdc, 0, 0, SRCAND)); } @@ -749,7 +780,8 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable, bounds.height = height; region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width); - generic_draw (drawable, gc, GDK_GC_FOREGROUND|LINE_ATTRIBUTES, + generic_draw (drawable, gc, + GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES), draw_rectangle, region, filled, x, y, width, height); gdk_region_destroy (region); @@ -852,7 +884,8 @@ gdk_win32_draw_arc (GdkDrawable *drawable, bounds.height = height; region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width); - generic_draw (drawable, gc, GDK_GC_FOREGROUND|LINE_ATTRIBUTES, + generic_draw (drawable, gc, + GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES), draw_arc, region, filled, x, y, width, height, angle1, angle2); gdk_region_destroy (region); @@ -933,7 +966,8 @@ gdk_win32_draw_polygon (GdkDrawable *drawable, region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width); - generic_draw (drawable, gc, GDK_GC_FOREGROUND|LINE_ATTRIBUTES, + generic_draw (drawable, gc, + GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES), draw_polygon, region, filled, pts, npoints); gdk_region_destroy (region); diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c index eb975879e0..0c80d22fb0 100644 --- a/gdk/win32/gdkmain-win32.c +++ b/gdk/win32/gdkmain-win32.c @@ -417,7 +417,7 @@ gdk_win32_print_dc (HDC hdc) RECT rect; int flag; - g_print ("%p\n", hdc); + g_print ("%p:\n", hdc); obj = GetCurrentObject (hdc, OBJ_BRUSH); GetObject (obj, sizeof (LOGBRUSH), &logbrush); g_print ("brush: %s color=%06lx hatch=%p\n", @@ -550,6 +550,8 @@ gdk_win32_gcvalues_mask_to_string (GdkGCValuesMask mask) gchar *bufp = buf; gchar *s = ""; + buf[0] = '\0'; + #define BIT(x) \ if (mask & GDK_GC_##x) \ (bufp += sprintf (bufp, "%s" #x, s), s = "|")