GBA Video: Code cleanup
Vicki Pfau vi@endrift.com
Mon, 24 Aug 2020 14:57:04 -0700
2 files changed,
5 insertions(+),
14 deletions(-)
M
src/gba/renderers/software-bg.c
→
src/gba/renderers/software-bg.c
@@ -94,7 +94,7 @@ y += background->dy; \
\ uint32_t current = *pixel; \ MOSAIC(COORD) \ - if (pixelData) { \ + if (pixelData && IS_WRITABLE(current)) { \ COMPOSITE_256_ ## OBJWIN (BLEND, 0); \ } \ }
M
src/gba/renderers/software-private.h
→
src/gba/renderers/software-private.h
@@ -43,7 +43,7 @@ if (color >= current) {
if (current & FLAG_TARGET_1 && color & FLAG_TARGET_2) { color = _mix(renderer->blda, current, renderer->bldb, color); } else { - color = (current & 0x00FFFFFF) | (current & (FLAG_REBLEND | FLAG_OBJWIN)); + color = current & (0x00FFFFFF | FLAG_REBLEND | FLAG_OBJWIN); } } else { color = (color & ~FLAG_TARGET_2) | (current & FLAG_OBJWIN);@@ -52,14 +52,11 @@ *pixel = color;
} static inline void _compositeBlendNoObjwin(struct GBAVideoSoftwareRenderer* renderer, uint32_t* pixel, uint32_t color, uint32_t current) { - if (!IS_WRITABLE(current)) { \ - return; \ - } \ if (color >= current) { if (current & FLAG_TARGET_1 && color & FLAG_TARGET_2) { color = _mix(renderer->blda, current, renderer->bldb, color); } else { - color = (current & 0x00FFFFFF) | (current & (FLAG_REBLEND | FLAG_OBJWIN)); + color = current & (0x00FFFFFF | FLAG_REBLEND | FLAG_OBJWIN); } } else { color = color & ~FLAG_TARGET_2;@@ -73,7 +70,7 @@ UNUSED(renderer);
if (color < current) { color |= (current & FLAG_OBJWIN); } else { - color = (current & 0x00FFFFFF) | (current & (FLAG_REBLEND | FLAG_OBJWIN)); + color = current & (0x00FFFFFF | FLAG_REBLEND | FLAG_OBJWIN); } *pixel = color; }@@ -82,15 +79,12 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* renderer, uint32_t* pixel, uint32_t color,
uint32_t current) { UNUSED(renderer); if (color >= current) { - color = (current & 0x00FFFFFF) | (current & (FLAG_REBLEND | FLAG_OBJWIN)); + color = current & (0x00FFFFFF | FLAG_REBLEND | FLAG_OBJWIN); } *pixel = color; } #define COMPOSITE_16_OBJWIN(BLEND, IDX) \ - if (!IS_WRITABLE(current)) { \ - continue; \ - } \ if (objwinForceEnable || (!(current & FLAG_OBJWIN)) == objwinOnly) { \ unsigned color = (current & FLAG_OBJWIN) ? objwinPalette[paletteData | pixelData] : palette[pixelData]; \ unsigned mergedFlags = flags; \@@ -104,9 +98,6 @@ #define COMPOSITE_16_NO_OBJWIN(BLEND, IDX) \
_composite ## BLEND ## NoObjwin(renderer, &pixel[IDX], palette[pixelData] | flags, current); #define COMPOSITE_256_OBJWIN(BLEND, IDX) \ - if (!IS_WRITABLE(current)) { \ - continue; \ - } \ if (objwinForceEnable || (!(current & FLAG_OBJWIN)) == objwinOnly) { \ unsigned color = (current & FLAG_OBJWIN) ? objwinPalette[pixelData] : palette[pixelData]; \ unsigned mergedFlags = flags; \