From 222bca24c12e162669c1a810c3102811f21cfbe4 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 5 Sep 2008 22:03:35 +0000 Subject: svn merge -r95288:95907 svn+ssh://svn.lindenlab.com/svn/linden/qa/maint-server/qar-841 this is a combined mergeback of the following branches as per QAR-841: maint-server/maint-server-1 (absorbed by maint-server-2) maint-server/maint-server-2 maint-server/maint-server-3 havok4/havok4-8 havok4/havok4-9 yes dataserver-is-deprecated --- indra/llimage/llimage.cpp | 75 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 15 deletions(-) (limited to 'indra/llimage/llimage.cpp') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index ef1467ce50..4f4473a366 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -43,6 +43,49 @@ #include "llimagejpeg.h" #include "llimagepng.h" #include "llimagedxt.h" +#include "llimageworker.h" + +//--------------------------------------------------------------------------- +// LLImage +//--------------------------------------------------------------------------- + +//static +std::string LLImage::sLastErrorMessage; +LLMutex* LLImage::sMutex = NULL; + +//static +void LLImage::initClass(LLWorkerThread* workerthread) +{ + sMutex = new LLMutex(NULL); + if (workerthread) + { + LLImageWorker::initImageWorker(workerthread); + } + LLImageJ2C::openDSO(); +} + +//static +void LLImage::cleanupClass() +{ + LLImageJ2C::closeDSO(); + LLImageWorker::cleanupImageWorker(); + delete sMutex; + sMutex = NULL; +} + +//static +const std::string& LLImage::getLastError() +{ + static const std::string noerr("No Error"); + return sLastErrorMessage.empty() ? noerr : sLastErrorMessage; +} + +//static +void LLImage::setLastError(const std::string& message) +{ + LLMutexLock m(sMutex); + sLastErrorMessage = message; +} //--------------------------------------------------------------------------- // LLImageBase @@ -95,21 +138,8 @@ void LLImageBase::sanityCheck() } } -std::string LLImageBase::sLastErrorMessage; BOOL LLImageBase::sSizeOverride = FALSE; -BOOL LLImageBase::setLastError(const std::string& message, const std::string& filename) -{ - sLastErrorMessage = message; - if (!filename.empty()) - { - sLastErrorMessage += " FILE:"; - sLastErrorMessage += filename; - } - llwarns << sLastErrorMessage << llendl; - return FALSE; -} - // virtual void LLImageBase::deleteData() { @@ -136,8 +166,6 @@ U8* LLImageBase::allocateData(S32 size) llerrs << "LLImageBase::allocateData: bad size: " << size << llendl; } - resetLastError(); - if (!mData || size != mDataSize) { deleteData(); // virtual @@ -1269,6 +1297,23 @@ LLImageFormatted::~LLImageFormatted() //---------------------------------------------------------------------------- +//virtual +void LLImageFormatted::resetLastError() +{ + LLImage::setLastError(""); +} + +//virtual +void LLImageFormatted::setLastError(const std::string& message, const std::string& filename) +{ + std::string error = message; + if (!filename.empty()) + error += std::string(" FILE: ") + filename; + LLImage::setLastError(error); +} + +//---------------------------------------------------------------------------- + // static LLImageFormatted* LLImageFormatted::createFromType(S8 codec) { -- cgit v1.2.3