all repos — mgba @ e3dac089e7c475c3b3d84274f0073c896f67099d

mGBA Game Boy Advance Emulator

Small refactor of _composite
Jeffrey Pfau jeffrey@endrift.com
Tue, 05 Nov 2013 21:57:24 -0800
commit

e3dac089e7c475c3b3d84274f0073c896f67099d

parent

818ce96d0dd8be7f0e5c476f8667d5890230f7af

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

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

@@ -616,20 +616,21 @@ // We stash the priority on the top bits so we can do a one-operator comparison

// The lower the number, the higher the priority, and sprites take precendence over backgrounds // We want to do special processing if the color pixel is target 1, however if (current & FLAG_UNWRITTEN) { - *pixel = color | (current & FLAG_OBJWIN); + color |= (current & FLAG_OBJWIN); } else if ((color & FLAG_ORDER_MASK) < (current & FLAG_ORDER_MASK)) { if (!(color & FLAG_TARGET_1) || !(current & FLAG_TARGET_2)) { - *pixel = color | FLAG_FINALIZED; + color |= FLAG_FINALIZED; } else { - *pixel = _mix(renderer->bldb, current, renderer->blda, color) | FLAG_FINALIZED; + color = _mix(renderer->bldb, current, renderer->blda, color) | FLAG_FINALIZED; } } else { if (current & FLAG_TARGET_1 && color & FLAG_TARGET_2) { - *pixel = _mix(renderer->blda, current, renderer->bldb, color) | FLAG_FINALIZED; + color = _mix(renderer->blda, current, renderer->bldb, color) | FLAG_FINALIZED; } else { - *pixel = current | FLAG_FINALIZED; + color = current | FLAG_FINALIZED; } } + *pixel = color; } #define BACKGROUND_DRAW_PIXEL_16 \