changeset 2082:a0a6f5a3fbbf

Fix plane buffer size calculation for IFF ACBM to round up to nearest byte (minimum of 1).
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 10 Dec 2018 20:48:46 +0200
parents a14286e2710e
children feed844a5ae1
files tools/libgfx.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tools/libgfx.c	Mon Dec 10 20:35:18 2018 +0200
+++ b/tools/libgfx.c	Mon Dec 10 20:48:46 2018 +0200
@@ -1691,7 +1691,7 @@
     else
     if (iff->idsig == IFF_ID_ACBM)
     {
-        bufLen = (img->width * img->height) / 8;
+        bufLen = (img->width * img->height + 7) / 8;
         dmMsg(2, "IFF: Plane buffer size %d bytes.\n", bufLen);
     }
 
@@ -2360,10 +2360,10 @@
 
     // Allocate encoding buffer
     if (iff.idsig == IFF_ID_ILBM)
-        bufLen = (((img->width * spec->scaleX) + 15) / 16) * 2;
+        bufLen = ((img->width * spec->scaleX + 15) / 16) * 2;
     else
     if (iff.idsig == IFF_ID_ACBM)
-        bufLen = (img->width * spec->scaleX * img->height * spec->scaleY) / 8;
+        bufLen = (img->width * spec->scaleX * img->height * spec->scaleY + 7) / 8;
     else
         bufLen = img->width * spec->scaleX;