aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage/llimage.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llimage/llimage.cpp77
1 files changed, 61 insertions, 16 deletions
diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp
index 814e82f..d4489fc 100644
--- a/linden/indra/llimage/llimage.cpp
+++ b/linden/indra/llimage/llimage.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2001-2008, Linden Research, Inc. 7 * Copyright (c) 2001-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -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
53std::string LLImage::sLastErrorMessage;
54LLMutex* LLImage::sMutex = NULL;
55
56//static
57void 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
68void LLImage::cleanupClass()
69{
70 LLImageJ2C::closeDSO();
71 LLImageWorker::cleanupImageWorker();
72 delete sMutex;
73 sMutex = NULL;
74}
75
76//static
77const std::string& LLImage::getLastError()
78{
79 static const std::string noerr("No Error");
80 return sLastErrorMessage.empty() ? noerr : sLastErrorMessage;
81}
82
83//static
84void 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
98std::string LLImageBase::sLastErrorMessage;
99BOOL LLImageBase::sSizeOverride = FALSE; 141BOOL LLImageBase::sSizeOverride = FALSE;
100 142
101BOOL 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
114void LLImageBase::deleteData() 144void 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
1301void LLImageFormatted::resetLastError()
1302{
1303 LLImage::setLastError("");
1304}
1305
1306//virtual
1307void 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
1273LLImageFormatted* LLImageFormatted::createFromType(S8 codec) 1318LLImageFormatted* LLImageFormatted::createFromType(S8 codec)
1274{ 1319{