From b16d060247bc58c483481b493ffad907b7fa2192 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 6 Jan 2016 13:19:48 +0100 Subject: [PATCH] Changed: Code simplification --- code/nel/src/misc/bitmap.cpp | 38 +++++++++--------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/code/nel/src/misc/bitmap.cpp b/code/nel/src/misc/bitmap.cpp index 67557b5cf..00cf7c293 100644 --- a/code/nel/src/misc/bitmap.cpp +++ b/code/nel/src/misc/bitmap.cpp @@ -2599,7 +2599,7 @@ uint8 CBitmap::readTGA( NLMISC::IStream &f) case 10: { uint8 packet; - uint8 pixel[4]; + uint8 pixel[4] = {0}; uint32 imageSize = width*height; uint32 readSize = 0; uint8 upSideDown = ((desc & (1 << 5))==0); @@ -2617,20 +2617,10 @@ uint8 CBitmap::readTGA( NLMISC::IStream &f) } for (i=0; i < (packet & 0x7F) + 1; i++) { - if(imageDepth==32) - { - _Data[0][dstId++]= pixel[2]; - _Data[0][dstId++]= pixel[1]; - _Data[0][dstId++]= pixel[0]; - _Data[0][dstId++]= pixel[3]; - } - if(imageDepth==24) - { - _Data[0][dstId++]= pixel[2]; - _Data[0][dstId++]= pixel[1]; - _Data[0][dstId++]= pixel[0]; - _Data[0][dstId++]= 0; - } + _Data[0][dstId++]= pixel[2]; + _Data[0][dstId++]= pixel[1]; + _Data[0][dstId++]= pixel[0]; + _Data[0][dstId++]= pixel[3]; } } else // packet Raw @@ -2641,20 +2631,10 @@ uint8 CBitmap::readTGA( NLMISC::IStream &f) { f.serial(pixel[j]); } - if(imageDepth==32) - { - _Data[0][dstId++]= pixel[2]; - _Data[0][dstId++]= pixel[1]; - _Data[0][dstId++]= pixel[0]; - _Data[0][dstId++]= pixel[3]; - } - if(imageDepth==24) - { - _Data[0][dstId++]= pixel[2]; - _Data[0][dstId++]= pixel[1]; - _Data[0][dstId++]= pixel[0]; - _Data[0][dstId++]= 0; - } + _Data[0][dstId++]= pixel[2]; + _Data[0][dstId++]= pixel[1]; + _Data[0][dstId++]= pixel[0]; + _Data[0][dstId++]= pixel[3]; } } readSize += (packet & 0x7F) + 1;