aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegazig <megazig@megazig-desktop.(none)>2010-11-05 14:44:48 -0500
committermegazig <megazig@megazig-desktop.(none)>2010-11-05 15:22:24 -0500
commit5fb11b8624ecd8adf36bcadd96afc8f359da22e9 (patch)
treea3a099204d45076409a89ade7313398b20895c46
parent7af9392688917662e4b2c7cdee0f8a05854b9c90 (diff)
hopefully fixed rgb565
commit attempt #2
-rw-r--r--zetsubou/tpl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/zetsubou/tpl.c b/zetsubou/tpl.c
index 41c7b67..bcc1d06 100644
--- a/zetsubou/tpl.c
+++ b/zetsubou/tpl.c
@@ -39,9 +39,9 @@ int TPL_ConvertRGB565ToBitMap(u8* tplbuf, u32 tplsize, u32 tplpoint, u8** bitmap
continue;
u16 oldpixel = *(u16*)(tplbuf + (tplpoint + ((iv++) * 2)));
oldpixel = be16(oldpixel);
- u8 b = ((oldpixel >> 11) & 0x1F) << 3;
- u8 g = ((oldpixel >> 5) & 0x3F) << 2;
- u8 r = ((oldpixel >> 0) & 0x1F) << 3;
+ u8 b = ((oldpixel>>11) &0x1F) *(255/0x1f);
+ u8 g = ((oldpixel>>5) &0x3F) *(255/0x3f);
+ u8 r = ((oldpixel>>0) &0x1F) *(255/0x1f);
u8 a = 255;
u32 rgba = (r << 0) | (g << 8) | (b << 16) | (a << 24);
(*(u32**)bitmapdata)[x + (y * width)] = rgba;
@@ -79,7 +79,7 @@ int TPL_ConvertBitMapToRGB565(u8* bitmapdata, u32 bitmapsize, u8** tplbuf, u32 w
u8 b = (rgba >> 16) & 0xFF;
// u8 a = (rgba >> 24) & 0xFF;
- newpixel = ((b >> 3) << 11) | ((g >> 2) << 5) | ((r >> 3) << 0);
+ newpixel = ((b/(255/0x1f)) << 11) | ((g/(255/0x3f)) << 5) | ((r/(255/0x1f)) << 0);
}
((u16*)writebuf)[iv++] = be16(newpixel);
}