* clutter/cogl/common/cogl-bitmap-pixbuf.c:

(_cogl_bitmap_from_file): allocate height×rowstride and not duplicate
gdkpixbuf's strange optimization saving some bytes at the end of the
pixbuf.
This commit is contained in:
Øyvind Kolås 2008-06-06 12:53:35 +00:00
parent 93abcf9595
commit 1ee75faaa4

View File

@ -134,7 +134,7 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
/* FIXME: Any way to destroy pixbuf but retain pixel data? */ /* FIXME: Any way to destroy pixbuf but retain pixel data? */
pixels = gdk_pixbuf_get_pixels (pixbuf); pixels = gdk_pixbuf_get_pixels (pixbuf);
out_data = (guchar*) g_malloc ((height - 1) * rowstride + last_row_size); out_data = (guchar*) g_malloc (height * rowstride);
out = out_data; out = out_data;
/* Copy up to last row */ /* Copy up to last row */
@ -152,7 +152,10 @@ _cogl_bitmap_from_file (CoglBitmap *bmp,
g_object_unref (pixbuf); g_object_unref (pixbuf);
/* Store bitmap info */ /* Store bitmap info */
bmp->data = out_data; bmp->data = out_data; /* The stored data the same alignment constraints as a
* gdkpixbuf but stores a full rowstride in the last
* scanline
*/
bmp->format = pixel_format; bmp->format = pixel_format;
bmp->width = width; bmp->width = width;
bmp->height = height; bmp->height = height;