Work around bugs in the runlength encoder by forcing rowstride * height to

2004-08-24  Matthias Clasen  <mclasen@redhat.com>

	* gdk-pixdata.c (gdk_pixdata_from_pixbuf): Work around bugs in
	the runlength encoder by forcing rowstride * height to be
	divisible by bpp.  (#150882)
This commit is contained in:
Matthias Clasen
2004-08-24 13:55:19 +00:00
committed by Matthias Clasen
parent 03b6cf491d
commit 2f06d8ad44
4 changed files with 35 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
2004-08-24 Matthias Clasen <mclasen@redhat.com>
* gdk-pixbuf/gdk-pixbuf-csource.xml: Document bugs of
the runlength encoder.
Sat Aug 14 19:15:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* === Released 2.4.7 ===

View File

@@ -154,7 +154,9 @@ Gtk+ distribution, available from <ulink url="http://www.gtk.org">www.gtk.org</u
<refsect1><title>Bugs</title>
<para>
None known yet.
The runlength encoder gets out of sync with the pixel boundaries, since
it includes the rowstride padding in the encoded stream. Furthermore, it
generates pixbufs with suboptimal rowstride in some cases.
</para>
</refsect1>

View File

@@ -1,3 +1,9 @@
2004-08-24 Matthias Clasen <mclasen@redhat.com>
* gdk-pixdata.c (gdk_pixdata_from_pixbuf): Work around bugs in
the runlength encoder by forcing rowstride * height to be
divisible by bpp. (#150882)
Mon Aug 23 00:51:20 2004 Matthias Clasen <maclas@gmx.de>
* pixops/pixops.c (pixops_scale_nearest): Make it

View File

@@ -327,16 +327,36 @@ gdk_pixdata_from_pixbuf (GdkPixdata *pixdata,
{
guint pad, n_bytes = rowstride * height;
guint8 *img_buffer_end, *data;
GdkPixbuf *buf = NULL;
if (n_bytes % bpp != 0)
{
rowstride = pixbuf->width * bpp;
n_bytes = rowstride * height;
data = g_malloc (n_bytes);
buf = gdk_pixbuf_new_from_data (data,
GDK_COLORSPACE_RGB,
pixbuf->has_alpha, 8,
pixbuf->width,
pixbuf->height,
rowstride,
NULL, NULL);
gdk_pixbuf_copy_area (pixbuf, 0, 0, pixbuf->width, pixbuf->height,
buf, 0, 0);
}
else
buf = pixbuf;
pad = rowstride;
pad = MAX (pad, 130 + n_bytes / 127);
data = g_new (guint8, pad + n_bytes);
free_me = data;
img_buffer = data;
img_buffer_end = rl_encode_rgbx (img_buffer,
pixbuf->pixels, pixbuf->pixels + n_bytes,
buf->pixels, buf->pixels + n_bytes,
bpp);
length = img_buffer_end - img_buffer;
if (buf != pixbuf)
g_object_unref (buf);
}
else
{