aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:38 -0500
committerJacek Antonelli2008-08-15 23:45:38 -0500
commitd7f00c03e236098b10ad5e30d35a0f159eb17255 (patch)
treed45c68b3a638b0545c88c1f644a6b9a689ce58e0 /linden/indra/llimage
parentSecond Life viewer sources 1.19.1.2 (diff)
downloadmeta-impy-d7f00c03e236098b10ad5e30d35a0f159eb17255.zip
meta-impy-d7f00c03e236098b10ad5e30d35a0f159eb17255.tar.gz
meta-impy-d7f00c03e236098b10ad5e30d35a0f159eb17255.tar.bz2
meta-impy-d7f00c03e236098b10ad5e30d35a0f159eb17255.tar.xz
Second Life viewer sources 1.19.1.3
Diffstat (limited to 'linden/indra/llimage')
-rw-r--r--linden/indra/llimage/llimage.cpp27
-rw-r--r--linden/indra/llimage/llimage.h9
2 files changed, 33 insertions, 3 deletions
diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp
index 15da71a..bcd9463 100644
--- a/linden/indra/llimage/llimage.cpp
+++ b/linden/indra/llimage/llimage.cpp
@@ -57,6 +57,7 @@ LLImageBase::LLImageBase()
57 mComponents(0), 57 mComponents(0),
58 mMemType(LLMemType::MTYPE_IMAGEBASE) 58 mMemType(LLMemType::MTYPE_IMAGEBASE)
59{ 59{
60 mBadBufferAllocation = FALSE ;
60} 61}
61 62
62// virtual 63// virtual
@@ -141,6 +142,7 @@ U8* LLImageBase::allocateData(S32 size)
141 if (!mData || size != mDataSize) 142 if (!mData || size != mDataSize)
142 { 143 {
143 deleteData(); // virtual 144 deleteData(); // virtual
145 mBadBufferAllocation = FALSE ;
144 mData = new U8[size]; 146 mData = new U8[size];
145 if (!mData) 147 if (!mData)
146 { 148 {
@@ -148,6 +150,7 @@ U8* LLImageBase::allocateData(S32 size)
148 llwarns << "allocate image data: " << size << llendl; 150 llwarns << "allocate image data: " << size << llendl;
149 size = 0 ; 151 size = 0 ;
150 mWidth = mHeight = 0 ; 152 mWidth = mHeight = 0 ;
153 mBadBufferAllocation = TRUE ;
151 } 154 }
152 mDataSize = size; 155 mDataSize = size;
153 } 156 }
@@ -176,6 +179,30 @@ U8* LLImageBase::reallocateData(S32 size)
176 return mData; 179 return mData;
177} 180}
178 181
182const U8* LLImageBase::getData() const
183{
184 if(mBadBufferAllocation)
185 {
186 llerrs << "Bad memory allocation for the image buffer!" << llendl ;
187 }
188
189 return mData;
190} // read only
191
192U8* LLImageBase::getData()
193{
194 if(mBadBufferAllocation)
195 {
196 llerrs << "Bad memory allocation for the image buffer!" << llendl ;
197 }
198
199 return mData;
200}
201
202BOOL LLImageBase::isBufferInvalid()
203{
204 return mBadBufferAllocation || mData == NULL ;
205}
179 206
180void LLImageBase::setSize(S32 width, S32 height, S32 ncomponents) 207void LLImageBase::setSize(S32 width, S32 height, S32 ncomponents)
181{ 208{
diff --git a/linden/indra/llimage/llimage.h b/linden/indra/llimage/llimage.h
index 8546303..199dc07 100644
--- a/linden/indra/llimage/llimage.h
+++ b/linden/indra/llimage/llimage.h
@@ -101,9 +101,10 @@ public:
101 S8 getComponents() const { return mComponents; } 101 S8 getComponents() const { return mComponents; }
102 S32 getDataSize() const { return mDataSize; } 102 S32 getDataSize() const { return mDataSize; }
103 103
104 const U8 *getData() const { return mData; } // read only 104 const U8 *getData() const ;
105 U8 *getData() { return mData; } 105 U8 *getData() ;
106 106 BOOL isBufferInvalid() ;
107
107 void setSize(S32 width, S32 height, S32 ncomponents); 108 void setSize(S32 width, S32 height, S32 ncomponents);
108 U8* allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 size = -1); // setSize() + allocateData() 109 U8* allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 size = -1); // setSize() + allocateData()
109 110
@@ -133,6 +134,8 @@ private:
133 134
134 S8 mComponents; 135 S8 mComponents;
135 136
137 BOOL mBadBufferAllocation ;
138
136public: 139public:
137 S16 mMemType; // debug 140 S16 mMemType; // debug
138 141