diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llimage/llimagej2c.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/linden/indra/llimage/llimagej2c.cpp b/linden/indra/llimage/llimagej2c.cpp index 87852e7..51d9522 100644 --- a/linden/indra/llimage/llimagej2c.cpp +++ b/linden/indra/llimage/llimagej2c.cpp | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | #include "lldir.h" | 31 | #include "lldir.h" |
32 | #include "llimagej2c.h" | 32 | #include "llimagej2c.h" |
33 | #include "llmemory.h" | 33 | #include "llmemtype.h" |
34 | 34 | ||
35 | typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); | 35 | typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); |
36 | typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); | 36 | typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); |
@@ -243,7 +243,22 @@ BOOL LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time, S32 first_chann | |||
243 | // Update the raw discard level | 243 | // Update the raw discard level |
244 | updateRawDiscardLevel(); | 244 | updateRawDiscardLevel(); |
245 | 245 | ||
246 | return mImpl->decodeImpl(*this, *raw_imagep, decode_time, first_channel, max_channel_count); | 246 | mDecoding = TRUE; |
247 | BOOL res = mImpl->decodeImpl(*this, *raw_imagep, decode_time, first_channel, max_channel_count); | ||
248 | if (res) | ||
249 | { | ||
250 | if (!mDecoding) | ||
251 | { | ||
252 | // Failed | ||
253 | raw_imagep->deleteData(); | ||
254 | } | ||
255 | else | ||
256 | { | ||
257 | mDecoding = FALSE; | ||
258 | } | ||
259 | return TRUE; // done | ||
260 | } | ||
261 | return FALSE; | ||
247 | } | 262 | } |
248 | 263 | ||
249 | 264 | ||
@@ -353,7 +368,7 @@ BOOL LLImageJ2C::loadAndValidate(const LLString &filename) | |||
353 | U8 *data = new U8[file_size]; | 368 | U8 *data = new U8[file_size]; |
354 | apr_size_t bytes_read = file_size; | 369 | apr_size_t bytes_read = file_size; |
355 | apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read | 370 | apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read |
356 | if (s != APR_SUCCESS || bytes_read != file_size) | 371 | if (s != APR_SUCCESS || (S32)bytes_read != file_size) |
357 | { | 372 | { |
358 | delete[] data; | 373 | delete[] data; |
359 | setLastError("Unable to read entire file"); | 374 | setLastError("Unable to read entire file"); |
@@ -368,9 +383,9 @@ BOOL LLImageJ2C::loadAndValidate(const LLString &filename) | |||
368 | BOOL LLImageJ2C::validate(U8 *data, U32 file_size) | 383 | BOOL LLImageJ2C::validate(U8 *data, U32 file_size) |
369 | { | 384 | { |
370 | LLMemType mt1((LLMemType::EMemType)mMemType); | 385 | LLMemType mt1((LLMemType::EMemType)mMemType); |
371 | // Taken from setData() | ||
372 | 386 | ||
373 | BOOL res = LLImageFormatted::setData(data, file_size); | 387 | setData(data, file_size); |
388 | BOOL res = updateData(); | ||
374 | if ( !res ) | 389 | if ( !res ) |
375 | { | 390 | { |
376 | return FALSE; | 391 | return FALSE; |
@@ -386,10 +401,9 @@ BOOL LLImageJ2C::validate(U8 *data, U32 file_size) | |||
386 | return mImpl->getMetadata(*this); | 401 | return mImpl->getMetadata(*this); |
387 | } | 402 | } |
388 | 403 | ||
389 | void LLImageJ2C::setDecodingDone(BOOL complete) | 404 | void LLImageJ2C::decodeFailed() |
390 | { | 405 | { |
391 | mDecoding = FALSE; | 406 | mDecoding = FALSE; |
392 | mDecoded = complete; | ||
393 | } | 407 | } |
394 | 408 | ||
395 | void LLImageJ2C::updateRawDiscardLevel() | 409 | void LLImageJ2C::updateRawDiscardLevel() |