Rearrange _composite to optimize for common cases first

This commit is contained in:
Jeffrey Pfau 2013-10-26 16:43:11 -07:00
parent 6e40c7ec29
commit f5a3fd7c7f
1 changed files with 4 additions and 4 deletions

View File

@ -613,10 +613,10 @@ static void _composite(struct GBAVideoSoftwareRenderer* renderer, int offset, ui
// We stash the priority on the top bits so we can do a one-operator comparison // 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 // 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 // We want to do special processing if the color pixel is target 1, however
if ((color & FLAG_ORDER_MASK) < (current & FLAG_ORDER_MASK)) { if (current & FLAG_UNWRITTEN) {
if (current & FLAG_UNWRITTEN) { renderer->row[offset] = color | (current & FLAG_OBJWIN);
renderer->row[offset] = color | (current & FLAG_OBJWIN); } else if ((color & FLAG_ORDER_MASK) < (current & FLAG_ORDER_MASK)) {
} else if (!(color & FLAG_TARGET_1) || !(current & FLAG_TARGET_2)) { if (!(color & FLAG_TARGET_1) || !(current & FLAG_TARGET_2)) {
renderer->row[offset] = color | FLAG_FINALIZED; renderer->row[offset] = color | FLAG_FINALIZED;
} else { } else {
renderer->row[offset] = _mix(renderer->bldb, current, renderer->blda, color) | FLAG_FINALIZED; renderer->row[offset] = _mix(renderer->bldb, current, renderer->blda, color) | FLAG_FINALIZED;