DS GX: Simplify loop

This commit is contained in:
Vicki Pfau 2017-03-02 02:14:08 -08:00
parent e9debb197e
commit 58381cf00f
1 changed files with 14 additions and 22 deletions

View File

@ -426,31 +426,23 @@ static void DSGXSoftwareRendererDrawScanline(struct DSGXRenderer* renderer, int
span = DSGXSoftwareSpanListGetPointer(&softwareRenderer->activeSpans, nextSpanId - 1);
nextSpanX = span->ep[0].x >> 12;
}
if (i < nextSpanX) {
span = NULL;
} else {
struct DSGXSoftwareSpan* testSpan = DSGXSoftwareSpanListGetPointer(&softwareRenderer->activeSpans, nextSpanId - 1);
while (i > (testSpan->ep[0].x >> 12)) {
if (i <= (testSpan->ep[1].x >> 12)) {
_lerpEndpoint(testSpan, &ep, i);
color_t color = _lookupColor(&ep, testSpan->poly);
if (scanline[i] == FLAG_UNWRITTEN) {
scanline[i] = color;
}
if (ep.w >= depth) {
depth = ep.w;
span = testSpan;
if (color != FLAG_UNWRITTEN) {
scanline[i] = color;
}
}
while (i > (span->ep[0].x >> 12)) {
if (i <= (span->ep[1].x >> 12)) {
_lerpEndpoint(span, &ep, i);
color_t color = _lookupColor(&ep, span->poly);
if (scanline[i] == FLAG_UNWRITTEN) {
scanline[i] = color;
}
--nextSpanId;
if (!nextSpanId) {
break;
if (ep.w >= depth && color != FLAG_UNWRITTEN) {
depth = ep.w;
scanline[i] = color;
}
testSpan = DSGXSoftwareSpanListGetPointer(&softwareRenderer->activeSpans, nextSpanId - 1);
}
--nextSpanId;
if (!nextSpanId) {
break;
}
span = DSGXSoftwareSpanListGetPointer(&softwareRenderer->activeSpans, nextSpanId - 1);
}
}
}