Revert "GBA Video: Optimize sprite drawing" This reverts commit 990df72ced66c4fa4a1f51684517bf4204c06a63.
Jeffrey Pfau jeffrey@endrift.com
Thu, 11 Aug 2016 03:47:23 -0700
3 files changed,
8 insertions(+),
37 deletions(-)
M
src/gba/renderers/software-bg.c
→
src/gba/renderers/software-bg.c
@@ -14,9 +14,10 @@
#define MODE_2_COORD_NO_OVERFLOW \ if ((x | y) & ~(sizeAdjusted - 1)) { \ continue; \ - } \ - localX = x; \ - localY = y; + } else { \ + localX = x; \ + localY = y; \ + } #define MODE_2_MOSAIC(COORD) \ if (!mosaicWait) { \
M
src/gba/renderers/software-obj.c
→
src/gba/renderers/software-obj.c
@@ -56,7 +56,7 @@ int localX = (xAccum >> 8) + (width >> 1); \
int localY = (yAccum >> 8) + (height >> 1); \ \ if (localX & widthMask || localY & heightMask) { \ - break; \ + continue; \ } \ \ SPRITE_YBASE_ ## DEPTH(localY); \@@ -204,35 +204,6 @@ if (end < condition) {
condition = end; } - // Clip off early pixels - if ((xAccum >> 8) < -(width >> 1) || (yAccum >> 8) < -(height >> 1)) { - int32_t diffX = -(width << 7) - xAccum; - int32_t diffY = -(height << 7) - yAccum; - int32_t x = mat.a ? diffX / mat.a : 0; - int32_t y = mat.c ? diffY / mat.c : 0; - if (y > x) { - x = y; - } - xAccum += mat.a * x; - yAccum += mat.c * x; - outX += x; - inX += x; - } - // Clip off late pixels - if ((xAccum >> 8) >= (width >> 1) || (yAccum >> 8) >= (height >> 1)) { - int32_t diffX = (width << 7) - xAccum; - int32_t diffY = (height << 7) - yAccum; - int32_t x = mat.a ? diffX / mat.a : 0; - int32_t y = mat.c ? diffY / mat.c : 0; - if (y > x) { - x = y; - } - xAccum += mat.a * x; - yAccum += mat.c * x; - outX += x; - inX += x; - } - if (!GBAObjAttributesAIs256Color(sprite->a)) { palette = &palette[GBAObjAttributesCGetPalette(sprite->c) << 4]; if (flags & FLAG_OBJWIN) {@@ -259,7 +230,7 @@ } else {
int outX = x >= start ? x : start; int condition = x + width; int mosaicH = 1; - if (mosaicH > 1) { + if (GBAObjAttributesAIsMosaic(sprite->a)) { mosaicH = GBAMosaicControlGetObjH(renderer->mosaic) + 1; if (condition % mosaicH) { condition += mosaicH - (condition % mosaicH);@@ -284,7 +255,7 @@ if (!GBAObjAttributesAIs256Color(sprite->a)) {
palette = &palette[GBAObjAttributesCGetPalette(sprite->c) << 4]; if (flags & FLAG_OBJWIN) { SPRITE_NORMAL_LOOP(16, OBJWIN); - } else if (mosaicH > 1) { + } else if (GBAObjAttributesAIsMosaic(sprite->a)) { if (objwinSlowPath) { objwinPalette = &objwinPalette[GBAObjAttributesCGetPalette(sprite->c) << 4]; SPRITE_MOSAIC_LOOP(16, NORMAL_OBJWIN);@@ -300,7 +271,7 @@ }
} else { if (flags & FLAG_OBJWIN) { SPRITE_NORMAL_LOOP(256, OBJWIN); - } else if (mosaicH > 1) { + } else if (GBAObjAttributesAIsMosaic(sprite->a)) { if (objwinSlowPath) { objwinPalette = &objwinPalette[GBAObjAttributesCGetPalette(sprite->c) << 4]; SPRITE_MOSAIC_LOOP(256, NORMAL_OBJWIN);