diff options
author | Owen Taylor <otaylor@src.gnome.org> | 1997-12-09 22:02:50 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1997-12-09 22:02:50 +0000 |
commit | 244e4fe4c7faa35b4680703106097012afea47bb (patch) | |
tree | 98975e65375f9ba103b674673acaf1479c2483b0 /gdk | |
parent | 2e943b280e1990d1ff5975c552a99b8857a69565 (diff) | |
download | gtk+-244e4fe4c7faa35b4680703106097012afea47bb.tar.gz |
Fix to pixmap mask handling. (gtk-fortier-971122-0.patch)
-owt
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkpixmap.c | 32 | ||||
-rw-r--r-- | gdk/x11/gdkpixmap-x11.c | 32 |
2 files changed, 44 insertions, 20 deletions
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index ab4cac3593..b1eaba214d 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -429,15 +429,21 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, gc = NULL; if (mask) { + /* The pixmap mask is just a bits pattern. + * Color 0 is used for background and 1 for foreground. + * We don't care about the colormap, we just need 0 and 1. + */ + GdkColor mask_pattern; + *mask = gdk_pixmap_new (window, width, height, 1); gc = gdk_gc_new (*mask); - - gdk_color_black (colormap, &tmp_color); - gdk_gc_set_foreground (gc, &tmp_color); + + mask_pattern.pixel = 0; + gdk_gc_set_foreground (gc, &mask_pattern); gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1); - - gdk_color_white (colormap, &tmp_color); - gdk_gc_set_foreground (gc, &tmp_color); + + mask_pattern.pixel = 1; + gdk_gc_set_foreground (gc, &mask_pattern); } for (ycnt = 0; ycnt < height; ycnt++) @@ -573,15 +579,21 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, gc = NULL; if (mask) { + /* The pixmap mask is just a bits pattern. + * Color 0 is used for background and 1 for foreground. + * We don't care about the colormap, we just need 0 and 1. + */ + GdkColor mask_pattern; + *mask = gdk_pixmap_new (window, width, height, 1); gc = gdk_gc_new (*mask); - gdk_color_black (colormap, &tmp_color); - gdk_gc_set_foreground (gc, &tmp_color); + mask_pattern.pixel = 0; + gdk_gc_set_foreground (gc, &mask_pattern); gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1); - gdk_color_white (colormap, &tmp_color); - gdk_gc_set_foreground (gc, &tmp_color); + mask_pattern.pixel = 1; + gdk_gc_set_foreground (gc, &mask_pattern); } for (ycnt = 0; ycnt < height; ycnt++) diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c index ab4cac3593..b1eaba214d 100644 --- a/gdk/x11/gdkpixmap-x11.c +++ b/gdk/x11/gdkpixmap-x11.c @@ -429,15 +429,21 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, gc = NULL; if (mask) { + /* The pixmap mask is just a bits pattern. + * Color 0 is used for background and 1 for foreground. + * We don't care about the colormap, we just need 0 and 1. + */ + GdkColor mask_pattern; + *mask = gdk_pixmap_new (window, width, height, 1); gc = gdk_gc_new (*mask); - - gdk_color_black (colormap, &tmp_color); - gdk_gc_set_foreground (gc, &tmp_color); + + mask_pattern.pixel = 0; + gdk_gc_set_foreground (gc, &mask_pattern); gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1); - - gdk_color_white (colormap, &tmp_color); - gdk_gc_set_foreground (gc, &tmp_color); + + mask_pattern.pixel = 1; + gdk_gc_set_foreground (gc, &mask_pattern); } for (ycnt = 0; ycnt < height; ycnt++) @@ -573,15 +579,21 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, gc = NULL; if (mask) { + /* The pixmap mask is just a bits pattern. + * Color 0 is used for background and 1 for foreground. + * We don't care about the colormap, we just need 0 and 1. + */ + GdkColor mask_pattern; + *mask = gdk_pixmap_new (window, width, height, 1); gc = gdk_gc_new (*mask); - gdk_color_black (colormap, &tmp_color); - gdk_gc_set_foreground (gc, &tmp_color); + mask_pattern.pixel = 0; + gdk_gc_set_foreground (gc, &mask_pattern); gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1); - gdk_color_white (colormap, &tmp_color); - gdk_gc_set_foreground (gc, &tmp_color); + mask_pattern.pixel = 1; + gdk_gc_set_foreground (gc, &mask_pattern); } for (ycnt = 0; ycnt < height; ycnt++) |