aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage/llimagetga.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llimage/llimagetga.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/llimage/llimagetga.cpp')
-rw-r--r--linden/indra/llimage/llimagetga.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/linden/indra/llimage/llimagetga.cpp b/linden/indra/llimage/llimagetga.cpp
index bd03abb..32c2111 100644
--- a/linden/indra/llimage/llimagetga.cpp
+++ b/linden/indra/llimage/llimagetga.cpp
@@ -30,6 +30,7 @@
30 30
31#include "linden_common.h" 31#include "linden_common.h"
32 32
33#include "lldir.h"
33#include "llimagetga.h" 34#include "llimagetga.h"
34#include "llerror.h" 35#include "llerror.h"
35#include "llmath.h" 36#include "llmath.h"
@@ -63,11 +64,34 @@ LLImageTGA::LLImageTGA()
63 mColorMapStart( 0 ), 64 mColorMapStart( 0 ),
64 mColorMapLength( 0 ), 65 mColorMapLength( 0 ),
65 mColorMapBytesPerEntry( 0 ), 66 mColorMapBytesPerEntry( 0 ),
66 mIs15Bit( FALSE ) 67 mIs15Bit( FALSE ),
68
69 mAttributeBits(0),
70 mColorMapDepth(0),
71 mColorMapIndexHi(0),
72 mColorMapIndexLo(0),
73 mColorMapLengthHi(0),
74 mColorMapLengthLo(0),
75 mColorMapType(0),
76 mDataOffset(0),
77 mHeightHi(0),
78 mHeightLo(0),
79 mIDLength(0),
80 mImageType(0),
81 mInterleave(0),
82 mOriginRightBit(0),
83 mOriginTopBit(0),
84 mPixelSize(0),
85 mWidthHi(0),
86 mWidthLo(0),
87 mXOffsetHi(0),
88 mXOffsetLo(0),
89 mYOffsetHi(0),
90 mYOffsetLo(0)
67{ 91{
68} 92}
69 93
70LLImageTGA::LLImageTGA(const LLString& file_name) 94LLImageTGA::LLImageTGA(const std::string& file_name)
71 : LLImageFormatted(IMG_CODEC_TGA), 95 : LLImageFormatted(IMG_CODEC_TGA),
72 mColorMap( NULL ), 96 mColorMap( NULL ),
73 mColorMapStart( 0 ), 97 mColorMapStart( 0 ),
@@ -1113,7 +1137,7 @@ BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight
1113} 1137}
1114 1138
1115// Reads a .tga file and creates an LLImageTGA with its data. 1139// Reads a .tga file and creates an LLImageTGA with its data.
1116bool LLImageTGA::loadFile( const LLString& path ) 1140bool LLImageTGA::loadFile( const std::string& path )
1117{ 1141{
1118 S32 len = path.size(); 1142 S32 len = path.size();
1119 if( len < 5 ) 1143 if( len < 5 )
@@ -1121,14 +1145,13 @@ bool LLImageTGA::loadFile( const LLString& path )
1121 return false; 1145 return false;
1122 } 1146 }
1123 1147
1124 LLString extension = path.substr( len - 4, 4 ); 1148 std::string extension = gDirUtilp->getExtension(path);
1125 LLString::toLower(extension); 1149 if( "tga" != extension )
1126 if( ".tga" != extension )
1127 { 1150 {
1128 return false; 1151 return false;
1129 } 1152 }
1130 1153
1131 LLFILE* file = LLFile::fopen(path.c_str(), "rb"); /* Flawfinder: ignore */ 1154 LLFILE* file = LLFile::fopen(path, "rb"); /* Flawfinder: ignore */
1132 if( !file ) 1155 if( !file )
1133 { 1156 {
1134 llwarns << "Couldn't open file " << path << llendl; 1157 llwarns << "Couldn't open file " << path << llendl;