summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/gdk-pixbuf.c
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2002-02-01 23:43:07 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2002-02-01 23:43:07 +0000
commit50e63083886d6b6cd86e893c99211e114b7225f9 (patch)
tree5e294b50dde0897c6395018afd0f11deddfed8f3 /gdk-pixbuf/gdk-pixbuf.c
parent4eb836706cdeb891fe8cc2ad3292cf23a3d2543a (diff)
downloadgtk+-50e63083886d6b6cd86e893c99211e114b7225f9.tar.gz
Merge 16- and 32-bit ico support from the stable branch. (#61179)
* io-ico.c: Merge 16- and 32-bit ico support from the stable branch. (#61179) * io-gif.c: Recomposite all images if the animation size changes while loading. (#70055) * gdk-pixbuf.c (gdk-pixbuf-fill): Make it work for subpixbufs. (#70055)
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf.c')
-rw-r--r--gdk-pixbuf/gdk-pixbuf.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c
index 5928ae0dfb..93c4c6db2c 100644
--- a/gdk-pixbuf/gdk-pixbuf.c
+++ b/gdk-pixbuf/gdk-pixbuf.c
@@ -428,7 +428,9 @@ gdk_pixbuf_fill (GdkPixbuf *pixbuf,
guchar *pixels;
gboolean all_the_same = FALSE;
guint r, g, b, a;
-
+ guchar *p;
+ gint n;
+
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
if (pixbuf->width == 0 || pixbuf->height == 0)
@@ -449,12 +451,13 @@ gdk_pixbuf_fill (GdkPixbuf *pixbuf,
}
if (all_the_same) {
- memset (pixels, r,
- pixbuf->rowstride * pixbuf->height);
+ if (pixbuf->has_alpha)
+ memset (pixels, r, pixbuf->width * 4);
+ else
+ memset (pixels, r, pixbuf->width * 3);
+
} else {
- guchar *p;
guchar c[4];
- gint n;
c[0] = r; c[1] = g; c[2] = b; c[3] = a;
@@ -472,12 +475,12 @@ gdk_pixbuf_fill (GdkPixbuf *pixbuf,
} while (--n);
}
- p = pixels;
- n = pixbuf->height - 1;
- while (n--) {
- p += pixbuf->rowstride;
- memcpy (p, pixels, pixbuf->width * pixbuf->n_channels);
- }
+ }
+ p = pixels;
+ n = pixbuf->height - 1;
+ while (n--) {
+ p += pixbuf->rowstride;
+ memcpy (p, pixels, pixbuf->width * pixbuf->n_channels);
}
}