Skip to content

Commit

Permalink
Bug 736029 - [PATCH] Remove redundant if/else branch in src/lodepng.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed Sep 9, 2014
1 parent e7b9f1d commit 3026131
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/lodepng.cpp
Expand Up @@ -3535,20 +3535,11 @@ static void filterScanline(unsigned char* out, const unsigned char* scanline, co
switch(filterType)
{
case 0:
if(prevline) for(i = 0; i < length; i++) out[i] = scanline[i];
else for(i = 0; i < length; i++) out[i] = scanline[i];
for(i = 0; i < length; i++) out[i] = scanline[i];
break;
case 1:
if(prevline)
{
for(i = 0; i < bytewidth; i++) out[i] = scanline[i];
for(i = bytewidth; i < length ; i++) out[i] = scanline[i] - scanline[i - bytewidth];
}
else
{
for(i = 0; i < bytewidth; i++) out[i] = scanline[i];
for(i = bytewidth; i < length; i++) out[i] = scanline[i] - scanline[i - bytewidth];
}
for(i = 0; i < bytewidth; i++) out[i] = scanline[i];
for(i = bytewidth; i < length; i++) out[i] = scanline[i] - scanline[i - bytewidth];
break;
case 2:
if(prevline) for(i = 0; i < length; i++) out[i] = scanline[i] - prevline[i];
Expand Down

0 comments on commit 3026131

Please sign in to comment.