# HG changeset patch # User Matti Hamalainen # Date 1544467726 -7200 # Node ID a0a6f5a3fbbfc82b0b2bc0d619472012da06672e # Parent a14286e2710e0559ac4d6ad4233c8b505b3af413 Fix plane buffer size calculation for IFF ACBM to round up to nearest byte (minimum of 1). diff -r a14286e2710e -r a0a6f5a3fbbf tools/libgfx.c --- 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;