summaryrefslogtreecommitdiff
path: root/indra/llimage/llimage.cpp
diff options
context:
space:
mode:
authorAndrew Meadows <andrew@lindenlab.com>2008-09-05 22:03:35 +0000
committerAndrew Meadows <andrew@lindenlab.com>2008-09-05 22:03:35 +0000
commit222bca24c12e162669c1a810c3102811f21cfbe4 (patch)
tree8eee52c0ffd4e9b03d624fc78d6547b8312a5c85 /indra/llimage/llimage.cpp
parent1493a212629b02a4323bf0c1f5a6960bc7b5e271 (diff)
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
Diffstat (limited to 'indra/llimage/llimage.cpp')
-rw-r--r--indra/llimage/llimage.cpp75
1 files changed, 60 insertions, 15 deletions
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)
{