summaryrefslogtreecommitdiff
path: root/snesgfx.c
diff options
context:
space:
mode:
Diffstat (limited to 'snesgfx.c')
-rw-r--r--snesgfx.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/snesgfx.c b/snesgfx.c
index 8e0de8a..d41350d 100644
--- a/snesgfx.c
+++ b/snesgfx.c
@@ -110,7 +110,7 @@ static void Convert4Colour16x16(png_bytep *data,
unsigned char *mem;
size_t size;
- size = width / 16 * height / 16 * 512;
+ size = ((width / 16 * height / 16) / 8 + 1) * 512;
if (!size)
{
@@ -137,7 +137,7 @@ static void Convert4Colour16x16(png_bytep *data,
int offset;
int f;
- offset = (tile / 16) * 512 + (tile % 16) * 32;
+ offset = (tile / 8) * 512 + (tile % 8) * 32;
GetPlanes(x, y, plane_left, 2, 16, data, width, height);
GetPlanes(x + 8, y, plane_right, 2, 16, data, width, height);
@@ -211,7 +211,7 @@ static void Convert16Colour16x16(png_bytep *data,
unsigned char *mem;
size_t size;
- size = width / 16 * height / 16 * 1024;
+ size = ((width / 16 * height / 16) / 8 + 1) * 1024;
if (!size)
{
@@ -238,7 +238,7 @@ static void Convert16Colour16x16(png_bytep *data,
int offset;
int f;
- offset = (tile / 16) * 1024 + (tile % 16) * 64;
+ offset = (tile / 8) * 1024 + (tile % 8) * 64;
GetPlanes(x, y, plane_left, 4, 16, data, width, height);
GetPlanes(x + 8, y, plane_right, 4, 16, data, width, height);