more rendering fixes and optimisations

This commit is contained in:
kub 2020-10-10 09:38:59 +02:00
parent 758abbebc2
commit 33cb1ab015
3 changed files with 66 additions and 11 deletions

View file

@ -41,6 +41,13 @@ static void convert_pal555(int invert_prio)
Pico32x.dirty_pal = 0;
}
// 555 conversion for direct color mode
#if defined(USE_BGR555)
#define DC555(t) t
#else
#define DC555(t) ((t&m1) << 11) | ((t&m2) << 1) | ((t&m3) >> 10)
#endif
// direct color mode
#define do_line_dc(pd, p32x, pmd, inv, pmd_draw_code) \
{ \
@ -53,12 +60,12 @@ static void convert_pal555(int invert_prio)
while (i > 0) { \
for (; i > 0 && (*pmd & 0x3f) == mdbg; pd++, pmd++, i--) { \
t = *p32x++; \
*pd = ((t&m1) << 11) | ((t&m2) << 1) | ((t&m3) >> 10); \
*pd = DC555(t); \
} \
for (; i > 0 && (*pmd & 0x3f) != mdbg; pd++, pmd++, i--) { \
t = *p32x++; \
if ((t ^ inv) & 0x8000) \
*pd = ((t&m1) << 11) | ((t&m2) << 1) | ((t&m3) >> 10); \
*pd = DC555(t); \
else \
pmd_draw_code; \
} \