all repos — mgba @ 15aa862d7046a71d82e84c8bd8c750f6b630b46d

mGBA Game Boy Advance Emulator

Small optimization for sprite drawing
Jeffrey Pfau jeffrey@endrift.com
Mon, 29 Jul 2013 00:44:38 -0700
commit

15aa862d7046a71d82e84c8bd8c750f6b630b46d

parent

425056ca15ea8c378d5f86b3a6713cb339726af7

1 files changed, 6 insertions(+), 1 deletions(-)

jump to
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -1015,7 +1015,12 @@ };

#define SPRITE_NORMAL_LOOP(DEPTH, TYPE) \ SPRITE_YBASE_ ## DEPTH(inY); \ - for (int outX = x >= start ? x : start; outX < x + width && outX < end; ++outX) { \ + int outX = x >= start ? x : start; \ + int condition = x + width; \ + if (end < condition) { \ + condition = end; \ + } \ + for (; outX < condition; ++outX) { \ int inX = outX - x; \ if (sprite->hflip) { \ inX = width - inX - 1; \