aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimagej2coj
diff options
context:
space:
mode:
authorJacek Antonelli2008-12-01 17:39:58 -0600
committerJacek Antonelli2008-12-01 17:40:06 -0600
commit7abecb48babe6a6f09bf6692ba55076546cfced9 (patch)
tree8d18a88513fb97adf32c10aae78f4be1984942db /linden/indra/llimagej2coj
parentSecond Life viewer sources 1.21.6 (diff)
downloadmeta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.zip
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.gz
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.bz2
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.xz
Second Life viewer sources 1.22.0-RC
Diffstat (limited to 'linden/indra/llimagej2coj')
-rw-r--r--linden/indra/llimagej2coj/CMakeLists.txt4
-rw-r--r--linden/indra/llimagej2coj/llimagej2coj.cpp19
2 files changed, 20 insertions, 3 deletions
diff --git a/linden/indra/llimagej2coj/CMakeLists.txt b/linden/indra/llimagej2coj/CMakeLists.txt
index ed3ff3c..97d22cf 100644
--- a/linden/indra/llimagej2coj/CMakeLists.txt
+++ b/linden/indra/llimagej2coj/CMakeLists.txt
@@ -29,3 +29,7 @@ set_source_files_properties(${llimagej2coj_HEADER_FILES}
29list(APPEND llimagej2coj_SOURCE_FILES ${llimagej2coj_HEADER_FILES}) 29list(APPEND llimagej2coj_SOURCE_FILES ${llimagej2coj_HEADER_FILES})
30 30
31add_library (llimagej2coj ${llimagej2coj_SOURCE_FILES}) 31add_library (llimagej2coj ${llimagej2coj_SOURCE_FILES})
32target_link_libraries(
33 llimagej2coj
34 ${OPENJPEG_LIBRARIES}
35 )
diff --git a/linden/indra/llimagej2coj/llimagej2coj.cpp b/linden/indra/llimagej2coj/llimagej2coj.cpp
index 983241c..7a62cfd 100644
--- a/linden/indra/llimagej2coj/llimagej2coj.cpp
+++ b/linden/indra/llimagej2coj/llimagej2coj.cpp
@@ -151,9 +151,11 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
151 // dereference the array. 151 // dereference the array.
152 if(!image || !image->numcomps) 152 if(!image || !image->numcomps)
153 { 153 {
154 fprintf(stderr, "ERROR -> decodeImpl: failed to decode image!\n"); 154 llwarns << "ERROR -> decodeImpl: failed to decode image!" << llendl;
155 if (image) 155 if (image)
156 {
156 opj_image_destroy(image); 157 opj_image_destroy(image);
158 }
157 159
158 return TRUE; // done 160 return TRUE; // done
159 } 161 }
@@ -170,6 +172,17 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
170 } 172 }
171 } 173 }
172 174
175 if(image->numcomps <= first_channel)
176 {
177 llwarns << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl;
178 if (image)
179 {
180 opj_image_destroy(image);
181 }
182
183 return TRUE;
184 }
185
173 // Copy image data into our raw image format (instead of the separate channel format 186 // Copy image data into our raw image format (instead of the separate channel format
174 187
175 S32 img_components = image->numcomps; 188 S32 img_components = image->numcomps;
@@ -211,7 +224,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
211 } 224 }
212 else // Some rare OpenJPEG versions have this bug. 225 else // Some rare OpenJPEG versions have this bug.
213 { 226 {
214 fprintf(stderr, "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)\n"); 227 llwarns << "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)" << llendl;
215 opj_image_destroy(image); 228 opj_image_destroy(image);
216 229
217 return TRUE; // done 230 return TRUE; // done
@@ -430,7 +443,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base)
430 443
431 if(!image) 444 if(!image)
432 { 445 {
433 fprintf(stderr, "ERROR -> getMetadata: failed to decode image!\n"); 446 llwarns << "ERROR -> getMetadata: failed to decode image!" << llendl;
434 return FALSE; 447 return FALSE;
435 } 448 }
436 449