summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexturelist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewertexturelist.cpp')
-rw-r--r--indra/newview/llviewertexturelist.cpp37
1 files changed, 33 insertions, 4 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index d331779e1f..cd6653b0c7 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -110,8 +110,8 @@ void LLViewerTextureList::doPreloadImages()
{
LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL;
- llassert_always(mInitialized) ;
- llassert_always(mImageList.empty()) ;
+ llassert_always(mInitialized) ;
+ llassert_always(mImageList.empty()) ;
llassert_always(mUUIDMap.empty()) ;
// Set the "missing asset" image
@@ -835,7 +835,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
for (entries_list_t::iterator iter3 = entries.begin();
iter3 != entries.end(); )
{
- LLPointer<LLViewerFetchedTexture> imagep = *iter3++;
+ LLViewerFetchedTexture* imagep = *iter3++;
bool fetching = imagep->updateFetch();
if (fetching)
@@ -946,16 +946,19 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
if (image.isNull())
{
+ image->setLastError("Couldn't open the image to be uploaded.");
return FALSE;
}
if (!image->load(filename))
{
+ image->setLastError("Couldn't load the image to be uploaded.");
return FALSE;
}
// Decompress or expand it in a raw image structure
LLPointer<LLImageRaw> raw_image = new LLImageRaw;
if (!image->decode(raw_image, 0.0f))
{
+ image->setLastError("Couldn't decode the image to be uploaded.");
return FALSE;
}
// Check the image constraints
@@ -966,8 +969,15 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
}
// Convert to j2c (JPEG2000) and save the file locally
LLPointer<LLImageJ2C> compressedImage = convertToUploadFile(raw_image);
+ if (compressedImage.isNull())
+ {
+ image->setLastError("Couldn't convert the image to jpeg2000.");
+ llinfos << "Couldn't convert to j2c, file : " << filename << llendl;
+ return FALSE;
+ }
if (!compressedImage->save(out_filename))
{
+ image->setLastError("Couldn't create the jpeg2000 image for upload.");
llinfos << "Couldn't create output file : " << out_filename << llendl;
return FALSE;
}
@@ -975,6 +985,7 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename,
LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
if (!integrity_test->loadAndValidate( out_filename ))
{
+ image->setLastError("The created jpeg2000 image is corrupt.");
llinfos << "Image file : " << out_filename << " is corrupt" << llendl;
return FALSE;
}
@@ -992,7 +1003,25 @@ LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImage
(raw_image->getWidth() * raw_image->getHeight() <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF))
compressedImage->setReversible(TRUE);
- compressedImage->encode(raw_image, 0.0f);
+
+ if (gSavedSettings.getBOOL("Jpeg2000AdvancedCompression"))
+ {
+ // This test option will create jpeg2000 images with precincts for each level, RPCL ordering
+ // and PLT markers. The block size is also optionally modifiable.
+ // Note: the images hence created are compatible with older versions of the viewer.
+ // Read the blocks and precincts size settings
+ S32 block_size = gSavedSettings.getS32("Jpeg2000BlocksSize");
+ S32 precinct_size = gSavedSettings.getS32("Jpeg2000PrecinctsSize");
+ llinfos << "Advanced JPEG2000 Compression: precinct = " << precinct_size << ", block = " << block_size << llendl;
+ compressedImage->initEncode(*raw_image, block_size, precinct_size, 0);
+ }
+
+ if (!compressedImage->encode(raw_image, 0.0f))
+ {
+ llinfos << "convertToUploadFile : encode returns with error!!" << llendl;
+ // Clear up the pointer so we don't leak that one
+ compressedImage = NULL;
+ }
return compressedImage;
}