[gimp] app: fix loading of a buffer's last tile in xcf-load.c
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: fix loading of a buffer's last tile in xcf-load.c
- Date: Sat, 22 Sep 2012 16:40:34 +0000 (UTC)
commit 025f0b03256d1489f46516a7df324f09d593c038
Author: Michael Natterer <mitch gimp org>
Date: Sat Sep 22 18:38:13 2012 +0200
app: fix loading of a buffer's last tile in xcf-load.c
The last tile is not followed by a next tile, so we don't have an
offset to the next tile and have to guess the number of bytes to load,
using the largest possible tile. That guessing was based on a maximum
of four bytes per pixel.
app/xcf/xcf-load.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 8b38ed3..861aadf 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -1434,6 +1434,7 @@ xcf_load_level (XcfInfo *info,
GeglBuffer *buffer)
{
const Babl *format;
+ gint bpp;
guint32 saved_pos;
guint32 offset, offset2;
gint n_tile_rows;
@@ -1445,6 +1446,7 @@ xcf_load_level (XcfInfo *info,
gint fail;
format = gegl_buffer_get_format (buffer);
+ bpp = babl_format_get_bytes_per_pixel (format);
info->cp += xcf_read_int32 (info->fp, (guint32 *) &width, 1);
info->cp += xcf_read_int32 (info->fp, (guint32 *) &height, 1);
@@ -1491,7 +1493,7 @@ xcf_load_level (XcfInfo *info,
/* if the offset is 0 then we need to read in the maximum possible
allowing for negative compression */
if (offset2 == 0)
- offset2 = offset + XCF_TILE_WIDTH * XCF_TILE_WIDTH * 4 * 1.5;
+ offset2 = offset + XCF_TILE_WIDTH * XCF_TILE_WIDTH * bpp * 1.5;
/* 1.5 is probably more
than we need to allow */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]