]> Pileus Git - ~andy/gtk/commitdiff
return solid masks for xpms that have no transparent color. This makes the
authorAlexander Larsson <alexl@redhat.com>
Fri, 23 Feb 2001 13:35:16 +0000 (13:35 +0000)
committerAlexander Larsson <alexl@src.gnome.org>
Fri, 23 Feb 2001 13:35:16 +0000 (13:35 +0000)
2001-02-23  Alexander Larsson  <alexl@redhat.com>

* 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.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/gdkpixmap.c

index cb942327f9855db82f4a026253942e127bffc0c1..e33f025632cde424404e6a6664157e3038d10465 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-02-23  Alexander Larsson  <alexl@redhat.com>
+
+       * 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  <tml@iki.fi>
 
        * README.win32: Update. Mention the gtk-1-3-win32-production
index cb942327f9855db82f4a026253942e127bffc0c1..e33f025632cde424404e6a6664157e3038d10465 100644 (file)
@@ -1,3 +1,10 @@
+2001-02-23  Alexander Larsson  <alexl@redhat.com>
+
+       * 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  <tml@iki.fi>
 
        * README.win32: Update. Mention the gtk-1-3-win32-production
index cb942327f9855db82f4a026253942e127bffc0c1..e33f025632cde424404e6a6664157e3038d10465 100644 (file)
@@ -1,3 +1,10 @@
+2001-02-23  Alexander Larsson  <alexl@redhat.com>
+
+       * 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  <tml@iki.fi>
 
        * README.win32: Update. Mention the gtk-1-3-win32-production
index cb942327f9855db82f4a026253942e127bffc0c1..e33f025632cde424404e6a6664157e3038d10465 100644 (file)
@@ -1,3 +1,10 @@
+2001-02-23  Alexander Larsson  <alexl@redhat.com>
+
+       * 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  <tml@iki.fi>
 
        * README.win32: Update. Mention the gtk-1-3-win32-production
index cb942327f9855db82f4a026253942e127bffc0c1..e33f025632cde424404e6a6664157e3038d10465 100644 (file)
@@ -1,3 +1,10 @@
+2001-02-23  Alexander Larsson  <alexl@redhat.com>
+
+       * 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  <tml@iki.fi>
 
        * README.win32: Update. Mention the gtk-1-3-win32-production
index cb942327f9855db82f4a026253942e127bffc0c1..e33f025632cde424404e6a6664157e3038d10465 100644 (file)
@@ -1,3 +1,10 @@
+2001-02-23  Alexander Larsson  <alexl@redhat.com>
+
+       * 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  <tml@iki.fi>
 
        * README.win32: Update. Mention the gtk-1-3-win32-production
index cb942327f9855db82f4a026253942e127bffc0c1..e33f025632cde424404e6a6664157e3038d10465 100644 (file)
@@ -1,3 +1,10 @@
+2001-02-23  Alexander Larsson  <alexl@redhat.com>
+
+       * 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  <tml@iki.fi>
 
        * README.win32: Update. Mention the gtk-1-3-win32-production
index 320320c92a7a49e2529ab209d25694e9abea9fe1..088e181a5ec8262fcdc80d1452eecb731bdd7316 100644 (file)
@@ -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;