aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Marshall <SquidMan72@gmail.com>2009-05-20 18:47:32 -0700
committerAlex Marshall <SquidMan72@gmail.com>2009-05-20 18:47:32 -0700
commitce5f828df9c91e32af9eeaca62fc96d38870985e (patch)
tree5c010a3975dd04b709be0ded3ef8aa29a76a0e4f
parent902e02d05eba051dc3b0f247b4da0f9e9d81331d (diff)
Something wrong with RGBA8 other than bugz
Diffstat (limited to '')
-rw-r--r--zetsubou/tpl.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/zetsubou/tpl.c b/zetsubou/tpl.c
index 98c9819..c6e4915 100644
--- a/zetsubou/tpl.c
+++ b/zetsubou/tpl.c
@@ -99,10 +99,10 @@ int TPL_ConvertRGBA8ToBitMap(u8* tplbuf, u32 tplsize, u32 tplpoint, u8** bitmapd
if(*bitmapdata == NULL)
return -1;
u32 outsz = width * height * 4;
- u8 a[8];
- u8 r[8];
- u8 g[8];
- u8 b[8];
+ u8 a[16];
+ u8 r[16];
+ u8 g[16];
+ u8 b[16];
int i = 0;
int z = 0;
int iv = 0;
@@ -115,7 +115,7 @@ int TPL_ConvertRGBA8ToBitMap(u8* tplbuf, u32 tplsize, u32 tplpoint, u8** bitmapd
height = goodheight;
u16 oldpixel = *(u16*)(tplbuf + (tplpoint + ((x + (y * width)) * 2)));
if((x >= width) || (y >= height)) {
- if(iv < 8) {
+ if(iv < 16) {
a[i] = 0;
r[i++] = 0;
}else{
@@ -123,7 +123,7 @@ int TPL_ConvertRGBA8ToBitMap(u8* tplbuf, u32 tplsize, u32 tplpoint, u8** bitmapd
b[i++] = 0;
}
}else{
- if(iv < 8) {
+ if(iv < 16) {
a[i] = (oldpixel >> 8) & 0xFF;
r[i++] = (oldpixel >> 0) & 0xFF;
}else{
@@ -132,13 +132,13 @@ int TPL_ConvertRGBA8ToBitMap(u8* tplbuf, u32 tplsize, u32 tplpoint, u8** bitmapd
}
}
iv++;
- if(iv == 8) i = 0; // Gotta reset i every 8 "pixels"!
- if(iv >= 16) iv = 0; // Swap every 16 "pixels"!
+ if(iv == 16) i = 0; // Gotta reset i every 16 "pixels"!
+ if(iv >= 32) iv = 0; // Swap every 32 "pixels"!
}
}
width = goodwidth; // Lolwut, we kept corrupting, so this makes sure it isn't.
height = goodheight;
- for(i = 0; i < 8; i++) {
+ for(i = 0; i < 16; i++) {
u32 rgba = (r[i] << 0) | (g[i] << 8) | (b[i] << 16) | (a[i] << 24);
(*(u32**)bitmapdata)[bmpslot++] = rgba;
}
@@ -781,6 +781,7 @@ int TPL_ConvertToGD(u8* tplbuf, u32 tplsize, char basename[], u32 format)
}
if(ret == -1) {
printf("Error converting file.\n");
+ gdImageDestroy(im);
return -1;
}
int x, y;