diff options
Diffstat (limited to 'linden/indra/llimage/llimage.cpp')
-rw-r--r-- | linden/indra/llimage/llimage.cpp | 75 |
1 files changed, 60 insertions, 15 deletions
diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp index 814e82f..71e7b41 100644 --- a/linden/indra/llimage/llimage.cpp +++ b/linden/indra/llimage/llimage.cpp | |||
@@ -43,6 +43,49 @@ | |||
43 | #include "llimagejpeg.h" | 43 | #include "llimagejpeg.h" |
44 | #include "llimagepng.h" | 44 | #include "llimagepng.h" |
45 | #include "llimagedxt.h" | 45 | #include "llimagedxt.h" |
46 | #include "llimageworker.h" | ||
47 | |||
48 | //--------------------------------------------------------------------------- | ||
49 | // LLImage | ||
50 | //--------------------------------------------------------------------------- | ||
51 | |||
52 | //static | ||
53 | std::string LLImage::sLastErrorMessage; | ||
54 | LLMutex* LLImage::sMutex = NULL; | ||
55 | |||
56 | //static | ||
57 | void LLImage::initClass(LLWorkerThread* workerthread) | ||
58 | { | ||
59 | sMutex = new LLMutex(NULL); | ||
60 | if (workerthread) | ||
61 | { | ||
62 | LLImageWorker::initImageWorker(workerthread); | ||
63 | } | ||
64 | LLImageJ2C::openDSO(); | ||
65 | } | ||
66 | |||
67 | //static | ||
68 | void LLImage::cleanupClass() | ||
69 | { | ||
70 | LLImageJ2C::closeDSO(); | ||
71 | LLImageWorker::cleanupImageWorker(); | ||
72 | delete sMutex; | ||
73 | sMutex = NULL; | ||
74 | } | ||
75 | |||
76 | //static | ||
77 | const std::string& LLImage::getLastError() | ||
78 | { | ||
79 | static const std::string noerr("No Error"); | ||
80 | return sLastErrorMessage.empty() ? noerr : sLastErrorMessage; | ||
81 | } | ||
82 | |||
83 | //static | ||
84 | void LLImage::setLastError(const std::string& message) | ||
85 | { | ||
86 | LLMutexLock m(sMutex); | ||
87 | sLastErrorMessage = message; | ||
88 | } | ||
46 | 89 | ||
47 | //--------------------------------------------------------------------------- | 90 | //--------------------------------------------------------------------------- |
48 | // LLImageBase | 91 | // LLImageBase |
@@ -95,21 +138,8 @@ void LLImageBase::sanityCheck() | |||
95 | } | 138 | } |
96 | } | 139 | } |
97 | 140 | ||
98 | std::string LLImageBase::sLastErrorMessage; | ||
99 | BOOL LLImageBase::sSizeOverride = FALSE; | 141 | BOOL LLImageBase::sSizeOverride = FALSE; |
100 | 142 | ||
101 | BOOL LLImageBase::setLastError(const std::string& message, const std::string& filename) | ||
102 | { | ||
103 | sLastErrorMessage = message; | ||
104 | if (!filename.empty()) | ||
105 | { | ||
106 | sLastErrorMessage += " FILE:"; | ||
107 | sLastErrorMessage += filename; | ||
108 | } | ||
109 | llwarns << sLastErrorMessage << llendl; | ||
110 | return FALSE; | ||
111 | } | ||
112 | |||
113 | // virtual | 143 | // virtual |
114 | void LLImageBase::deleteData() | 144 | void LLImageBase::deleteData() |
115 | { | 145 | { |
@@ -136,8 +166,6 @@ U8* LLImageBase::allocateData(S32 size) | |||
136 | llerrs << "LLImageBase::allocateData: bad size: " << size << llendl; | 166 | llerrs << "LLImageBase::allocateData: bad size: " << size << llendl; |
137 | } | 167 | } |
138 | 168 | ||
139 | resetLastError(); | ||
140 | |||
141 | if (!mData || size != mDataSize) | 169 | if (!mData || size != mDataSize) |
142 | { | 170 | { |
143 | deleteData(); // virtual | 171 | deleteData(); // virtual |
@@ -1269,6 +1297,23 @@ LLImageFormatted::~LLImageFormatted() | |||
1269 | 1297 | ||
1270 | //---------------------------------------------------------------------------- | 1298 | //---------------------------------------------------------------------------- |
1271 | 1299 | ||
1300 | //virtual | ||
1301 | void LLImageFormatted::resetLastError() | ||
1302 | { | ||
1303 | LLImage::setLastError(""); | ||
1304 | } | ||
1305 | |||
1306 | //virtual | ||
1307 | void LLImageFormatted::setLastError(const std::string& message, const std::string& filename) | ||
1308 | { | ||
1309 | std::string error = message; | ||
1310 | if (!filename.empty()) | ||
1311 | error += std::string(" FILE: ") + filename; | ||
1312 | LLImage::setLastError(error); | ||
1313 | } | ||
1314 | |||
1315 | //---------------------------------------------------------------------------- | ||
1316 | |||
1272 | // static | 1317 | // static |
1273 | LLImageFormatted* LLImageFormatted::createFromType(S8 codec) | 1318 | LLImageFormatted* LLImageFormatted::createFromType(S8 codec) |
1274 | { | 1319 | { |