diff options
Diffstat (limited to 'linden/indra/llimage/llimage.cpp')
-rw-r--r-- | linden/indra/llimage/llimage.cpp | 27 |
1 files changed, 27 insertions, 0 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 | ||
182 | const 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 | |||
192 | U8* LLImageBase::getData() | ||
193 | { | ||
194 | if(mBadBufferAllocation) | ||
195 | { | ||
196 | llerrs << "Bad memory allocation for the image buffer!" << llendl ; | ||
197 | } | ||
198 | |||
199 | return mData; | ||
200 | } | ||
201 | |||
202 | BOOL LLImageBase::isBufferInvalid() | ||
203 | { | ||
204 | return mBadBufferAllocation || mData == NULL ; | ||
205 | } | ||
179 | 206 | ||
180 | void LLImageBase::setSize(S32 width, S32 height, S32 ncomponents) | 207 | void LLImageBase::setSize(S32 width, S32 height, S32 ncomponents) |
181 | { | 208 | { |