From e3f5b66d5a649b061e470bba44fa29a56f7b93b5 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 20 Jan 2011 15:20:27 -0700 Subject: fix for SH-829: Viewer attempting to load precached images in file types that are not being used. --- indra/llimage/llimage.cpp | 18 +++++++++--------- indra/llimage/llimage.h | 4 ++-- indra/newview/lltexturecache.cpp | 6 ++++++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 5c33b675ca..38396916c7 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -276,11 +276,11 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components) ++sRawImageCount; } -LLImageRaw::LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only) - : LLImageBase() -{ - createFromFile(filename, j2c_lowest_mip_only); -} +//LLImageRaw::LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only) +// : LLImageBase() +//{ +// createFromFile(filename, j2c_lowest_mip_only); +//} LLImageRaw::~LLImageRaw() { @@ -1180,7 +1180,7 @@ file_extensions[] = { "png", IMG_CODEC_PNG } }; #define NUM_FILE_EXTENSIONS LL_ARRAY_SIZE(file_extensions) - +#if 0 static std::string find_file(std::string &name, S8 *codec) { std::string tname; @@ -1198,7 +1198,7 @@ static std::string find_file(std::string &name, S8 *codec) } return std::string(""); } - +#endif EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten) { for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++) @@ -1208,7 +1208,7 @@ EImageCodec LLImageBase::getCodecFromExtension(const std::string& exten) } return IMG_CODEC_INVALID; } - +#if 0 bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip_only) { std::string name = filename; @@ -1315,7 +1315,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip return true; } - +#endif //--------------------------------------------------------------------------- // LLImageFormatted //--------------------------------------------------------------------------- diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index bca7e915fa..825b9aab1a 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -164,7 +164,7 @@ public: LLImageRaw(U16 width, U16 height, S8 components); LLImageRaw(U8 *data, U16 width, U16 height, S8 components); // Construct using createFromFile (used by tools) - LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only = false); + //LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only = false); /*virtual*/ void deleteData(); /*virtual*/ U8* allocateData(S32 size = -1); @@ -226,7 +226,7 @@ public: protected: // Create an image from a local file (generally used in tools) - bool createFromFile(const std::string& filename, bool j2c_lowest_mip_only = false); + //bool createFromFile(const std::string& filename, bool j2c_lowest_mip_only = false); void copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ); void compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len ); diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 6a213309a0..83772496d5 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -326,6 +326,7 @@ bool LLTextureCacheRemoteWorker::doRead() // First state / stage : find out if the file is local if (mState == INIT) { +#if 0 std::string filename = mCache->getLocalFileName(mID); // Is it a JPEG2000 file? { @@ -360,6 +361,11 @@ bool LLTextureCacheRemoteWorker::doRead() } // Determine the next stage: if we found a file, then LOCAL else CACHE mState = (local_size > 0 ? LOCAL : CACHE); + + llassert_always(mState == CACHE) ; +#else + mState = CACHE; +#endif } // Second state / stage : if the file is local, load it and leave -- cgit v1.2.3