Small optimization for sprite drawing
Jeffrey Pfau jeffrey@endrift.com
Mon, 29 Jul 2013 00:44:38 -0700
1 files changed,
6 insertions(+),
1 deletions(-)
M
src/gba/renderers/video-software.c
→
src/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; \