diff --git a/ChangeLog b/ChangeLog index cb942327f9..e33f025632 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-02-23 Alexander Larsson + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_new_from_pixbuf): + return solid masks for xpms that have no transparent color. + This makes the ..._create_from_xpm... API backwards + compatible. + 2001-02-23 Tor Lillqvist * README.win32: Update. Mention the gtk-1-3-win32-production diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index cb942327f9..e33f025632 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +2001-02-23 Alexander Larsson + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_new_from_pixbuf): + return solid masks for xpms that have no transparent color. + This makes the ..._create_from_xpm... API backwards + compatible. + 2001-02-23 Tor Lillqvist * README.win32: Update. Mention the gtk-1-3-win32-production diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cb942327f9..e33f025632 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2001-02-23 Alexander Larsson + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_new_from_pixbuf): + return solid masks for xpms that have no transparent color. + This makes the ..._create_from_xpm... API backwards + compatible. + 2001-02-23 Tor Lillqvist * README.win32: Update. Mention the gtk-1-3-win32-production diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index cb942327f9..e33f025632 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +2001-02-23 Alexander Larsson + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_new_from_pixbuf): + return solid masks for xpms that have no transparent color. + This makes the ..._create_from_xpm... API backwards + compatible. + 2001-02-23 Tor Lillqvist * README.win32: Update. Mention the gtk-1-3-win32-production diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index cb942327f9..e33f025632 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +2001-02-23 Alexander Larsson + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_new_from_pixbuf): + return solid masks for xpms that have no transparent color. + This makes the ..._create_from_xpm... API backwards + compatible. + 2001-02-23 Tor Lillqvist * README.win32: Update. Mention the gtk-1-3-win32-production diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index cb942327f9..e33f025632 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +2001-02-23 Alexander Larsson + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_new_from_pixbuf): + return solid masks for xpms that have no transparent color. + This makes the ..._create_from_xpm... API backwards + compatible. + 2001-02-23 Tor Lillqvist * README.win32: Update. Mention the gtk-1-3-win32-production diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index cb942327f9..e33f025632 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2001-02-23 Alexander Larsson + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_new_from_pixbuf): + return solid masks for xpms that have no transparent color. + This makes the ..._create_from_xpm... API backwards + compatible. + 2001-02-23 Tor Lillqvist * README.win32: Update. Mention the gtk-1-3-win32-production diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index 320320c92a..088e181a5e 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -430,6 +430,25 @@ gdk_pixmap_get_image (GdkDrawable *drawable, x, y, width, height); } +static GdkBitmap * +make_solid_mask (gint width, gint height) +{ + GdkBitmap *bitmap; + GdkGC *gc; + GdkGCValues gc_values; + + bitmap = gdk_pixmap_new (NULL, width, height, 1); + + gc_values.foreground.pixel = 1; + gc = gdk_gc_new_with_values (bitmap, &gc_values, GDK_GC_FOREGROUND); + + gdk_draw_rectangle (bitmap, gc, TRUE, 0, 0, width, height); + + gdk_gc_unref (gc); + + return bitmap; +} + #define PACKED_COLOR(c) ((((c)->red & 0xff) << 8) | ((c)->green & 0xff) | ((c)->blue >> 8)) static GdkPixmap * @@ -473,6 +492,10 @@ gdk_pixmap_colormap_new_from_pixbuf (GdkColormap *colormap, if (mask) gdk_pixbuf_render_pixmap_and_mask (pixbuf, NULL, mask, 128); + if (mask && !*mask) + *mask = make_solid_mask (gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf)); + return pixmap; } @@ -498,8 +521,9 @@ gdk_pixmap_colormap_create_from_xpm (GdkWindow *window, return NULL; pixmap = gdk_pixmap_colormap_new_from_pixbuf (colormap, mask, transparent_color, pixbuf); - gdk_pixbuf_unref (pixbuf); + gdk_pixbuf_unref (pixbuf); + return pixmap; } @@ -535,6 +559,7 @@ gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window, return NULL; pixmap = gdk_pixmap_colormap_new_from_pixbuf (colormap, mask, transparent_color, pixbuf); + gdk_pixbuf_unref (pixbuf); return pixmap;