a comment asked to optimize this function, so that's what I did.
2001-08-07 Sven Neumann <sven@gimp.org> * gdk-pixbuf.c (gdk_pixbuf_fill): a comment asked to optimize this function, so that's what I did.
This commit is contained in:
parent
967c0f7c7b
commit
85a58dddba
@ -1,3 +1,8 @@
|
|||||||
|
2001-08-07 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* gdk-pixbuf.c (gdk_pixbuf_fill): a comment asked to optimize this
|
||||||
|
function, so that's what I did.
|
||||||
|
|
||||||
2001-08-06 Kjartan Maraas <kmaraas@gnome.org>
|
2001-08-06 Kjartan Maraas <kmaraas@gnome.org>
|
||||||
|
|
||||||
* gdk-pixdata.c: Fix a typo.
|
* gdk-pixdata.c: Fix a typo.
|
||||||
|
@ -429,6 +429,9 @@ gdk_pixbuf_fill (GdkPixbuf *pixbuf,
|
|||||||
|
|
||||||
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
|
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
|
||||||
|
|
||||||
|
if (pixbuf->width == 0 || pixbuf->height == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
pixels = pixbuf->pixels;
|
pixels = pixbuf->pixels;
|
||||||
|
|
||||||
r = (pixel & 0xff000000) >> 24;
|
r = (pixel & 0xff000000) >> 24;
|
||||||
@ -448,20 +451,30 @@ gdk_pixbuf_fill (GdkPixbuf *pixbuf,
|
|||||||
pixbuf->rowstride * pixbuf->height);
|
pixbuf->rowstride * pixbuf->height);
|
||||||
} else {
|
} else {
|
||||||
guchar *p;
|
guchar *p;
|
||||||
guchar *end;
|
guchar c[4];
|
||||||
|
gint n;
|
||||||
|
|
||||||
/* feel free to optimize this */
|
c[0] = r; c[1] = g; c[2] = b; c[3] = a;
|
||||||
|
|
||||||
p = pixels;
|
p = pixels;
|
||||||
end = pixels + pixbuf->rowstride * pixbuf->height;
|
n = pixbuf->width;
|
||||||
end -= (pixbuf->rowstride - pixbuf->width * pixbuf->n_channels);
|
if (pixbuf->has_alpha) {
|
||||||
|
do {
|
||||||
|
memcpy (p, c, 4);
|
||||||
|
p += 4;
|
||||||
|
} while (--n);
|
||||||
|
} else {
|
||||||
|
do {
|
||||||
|
memcpy (p, c, 3);
|
||||||
|
p += 3;
|
||||||
|
} while (--n);
|
||||||
|
}
|
||||||
|
|
||||||
while (p < end) {
|
p = pixels;
|
||||||
*p++ = r;
|
n = pixbuf->height - 1;
|
||||||
*p++ = g;
|
while (n--) {
|
||||||
*p++ = b;
|
p += pixbuf->rowstride;
|
||||||
if (pixbuf->has_alpha)
|
memcpy (p, pixels, pixbuf->width * pixbuf->n_channels);
|
||||||
*p++ = a;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user