Permalink
Browse files

Bug 736029 - [PATCH] Remove redundant if/else branch in src/lodepng.cpp

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Sep 9, 2014
1 parent e7b9f1d commit 3026131de3126298863d1a68fe0c747524e26e43
Showing with 3 additions and 12 deletions.
  1. +3 −12 src/lodepng.cpp
@@ -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];

0 comments on commit 3026131

Please sign in to comment.