summaryrefslogtreecommitdiff
path: root/indra/llimage/llimage.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-09-06 11:47:48 -0700
committerRichard Linden <none@none>2012-09-06 11:47:48 -0700
commit371b66a6ef7eb2568e3127c1c59326bce6e26ab8 (patch)
tree9154fa799fc37df8cb493f921b41ad79596e903c /indra/llimage/llimage.cpp
parente3b4b3875a6d8c7857ba948a662ace4731913ecf (diff)
parent2cdfb170216c798c637081b0e28ec8921f0b777b (diff)
Automated merge with http://bitbucket.org/lindenlab/viewer-development
Diffstat (limited to 'indra/llimage/llimage.cpp')
-rw-r--r--indra/llimage/llimage.cpp86
1 files changed, 1 insertions, 85 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index e6b838c5b2..2bbbf895ec 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -30,7 +30,6 @@
#include "llmath.h"
#include "v4coloru.h"
-#include "llmemtype.h"
#include "llimagebmp.h"
#include "llimagetga.h"
@@ -96,8 +95,7 @@ LLImageBase::LLImageBase()
mHeight(0),
mComponents(0),
mBadBufferAllocation(false),
- mAllowOverSize(false),
- mMemType(LLMemType::MTYPE_IMAGEBASE)
+ mAllowOverSize(false)
{
}
@@ -167,8 +165,6 @@ void LLImageBase::deleteData()
// virtual
U8* LLImageBase::allocateData(S32 size)
{
- LLMemType mt1(mMemType);
-
if (size < 0)
{
size = mWidth * mHeight * mComponents;
@@ -213,7 +209,6 @@ U8* LLImageBase::allocateData(S32 size)
// virtual
U8* LLImageBase::reallocateData(S32 size)
{
- LLMemType mt1(mMemType);
U8 *new_datap = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
if (!new_datap)
{
@@ -279,14 +274,12 @@ S32 LLImageRaw::sRawImageCount = 0;
LLImageRaw::LLImageRaw()
: LLImageBase()
{
- mMemType = LLMemType::MTYPE_IMAGERAW;
++sRawImageCount;
}
LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
: LLImageBase()
{
- mMemType = LLMemType::MTYPE_IMAGERAW;
//llassert( S32(width) * S32(height) * S32(components) <= MAX_IMAGE_DATA_SIZE );
allocateDataSize(width, height, components);
++sRawImageCount;
@@ -295,8 +288,6 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_copy)
: LLImageBase()
{
- mMemType = LLMemType::MTYPE_IMAGERAW;
-
if(no_copy)
{
setDataAndSize(data, width, height, components);
@@ -375,29 +366,6 @@ BOOL LLImageRaw::resize(U16 width, U16 height, S8 components)
return TRUE;
}
-#if 0
-U8 * LLImageRaw::getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const
-{
- LLMemType mt1(mMemType);
- U8 *data = new U8[width*height*getComponents()];
-
- // Should do some simple bounds checking
- if (!data)
- {
- llerrs << "Out of memory in LLImageRaw::getSubImage" << llendl;
- return NULL;
- }
-
- U32 i;
- for (i = y_pos; i < y_pos+height; i++)
- {
- memcpy(data + i*width*getComponents(), /* Flawfinder: ignore */
- getData() + ((y_pos + i)*getWidth() + x_pos)*getComponents(), getComponents()*width);
- }
- return data;
-}
-#endif
-
BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height,
const U8 *data, U32 stride, BOOL reverse_y)
{
@@ -462,7 +430,6 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a)
// Reverses the order of the rows in the image
void LLImageRaw::verticalFlip()
{
- LLMemType mt1(mMemType);
S32 row_bytes = getWidth() * getComponents();
llassert(row_bytes > 0);
std::vector<U8> line_buffer(row_bytes);
@@ -595,7 +562,6 @@ void LLImageRaw::composite( LLImageRaw* src )
// Src and dst can be any size. Src has 4 components. Dst has 3 components.
void LLImageRaw::compositeScaled4onto3(LLImageRaw* src)
{
- LLMemType mt1(mMemType);
llinfos << "compositeScaled4onto3" << llendl;
LLImageRaw* dst = this; // Just for clarity.
@@ -837,7 +803,6 @@ void LLImageRaw::copyUnscaled3onto4( LLImageRaw* src )
// Src and dst can be any size. Src and dst have same number of components.
void LLImageRaw::copyScaled( LLImageRaw* src )
{
- LLMemType mt1(mMemType);
LLImageRaw* dst = this; // Just for clarity.
llassert_always( (1 == src->getComponents()) || (3 == src->getComponents()) || (4 == src->getComponents()) );
@@ -866,57 +831,9 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
}
}
-#if 0
-//scale down image by not blending a pixel with its neighbors.
-BOOL LLImageRaw::scaleDownWithoutBlending( S32 new_width, S32 new_height)
-{
- LLMemType mt1(mMemType);
-
- S8 c = getComponents() ;
- llassert((1 == c) || (3 == c) || (4 == c) );
-
- S32 old_width = getWidth();
- S32 old_height = getHeight();
-
- S32 new_data_size = old_width * new_height * c ;
- llassert_always(new_data_size > 0);
-
- F32 ratio_x = (F32)old_width / new_width ;
- F32 ratio_y = (F32)old_height / new_height ;
- if( ratio_x < 1.0f || ratio_y < 1.0f )
- {
- return TRUE; // Nothing to do.
- }
- ratio_x -= 1.0f ;
- ratio_y -= 1.0f ;
-
- U8* new_data = allocateMemory(new_data_size) ;
- llassert_always(new_data != NULL) ;
-
- U8* old_data = getData() ;
- S32 i, j, k, s, t;
- for(i = 0, s = 0, t = 0 ; i < new_height ; i++)
- {
- for(j = 0 ; j < new_width ; j++)
- {
- for(k = 0 ; k < c ; k++)
- {
- new_data[s++] = old_data[t++] ;
- }
- t += (S32)(ratio_x * c + 0.1f) ;
- }
- t += (S32)(ratio_y * old_width * c + 0.1f) ;
- }
-
- setDataAndSize(new_data, new_width, new_height, c) ;
-
- return TRUE ;
-}
-#endif
BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
{
- LLMemType mt1(mMemType);
llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) );
S32 old_width = getWidth();
@@ -1346,7 +1263,6 @@ LLImageFormatted::LLImageFormatted(S8 codec)
mDiscardLevel(-1),
mLevels(0)
{
- mMemType = LLMemType::MTYPE_IMAGEFORMATTED;
}
// virtual