diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-04-01 17:45:04 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-04-01 17:45:04 +0000 |
commit | 941cb9f4124c9ccfd5c845bc94639fa46df12c3d (patch) | |
tree | e0f525e7bd6cc76d89b2df69c6f1554d191561e8 /indra/llimage | |
parent | ecec626dec93524f7ef5831a5ba344d6449b99bc (diff) |
merge release@83343 skinning-1-merge@83714 -> release
QAR-424
Diffstat (limited to 'indra/llimage')
-rw-r--r-- | indra/llimage/llimage.cpp | 27 | ||||
-rw-r--r-- | indra/llimage/llimage.h | 6 |
2 files changed, 17 insertions, 16 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index db19bd6ec6..a61b9cb0c0 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -43,6 +43,7 @@ #if JPEG_SUPPORT #include "llimagejpeg.h" #endif +#include "llimagepng.h" #include "llimagedxt.h" //--------------------------------------------------------------------------- @@ -460,8 +461,8 @@ void LLImageRaw::composite( LLImageRaw* src ) { LLImageRaw* dst = this; // Just for clarity. - llassert( (3 == src->getComponents()) || (4 == src->getComponents()) ); - llassert( (3 == dst->getComponents()) || (4 == dst->getComponents()) ); + llassert(3 == src->getComponents()); + llassert(3 == dst->getComponents()); if( 3 == dst->getComponents() ) { @@ -489,11 +490,6 @@ void LLImageRaw::composite( LLImageRaw* src ) } } } - else - { - // 4 == dst->mComponents - llassert(0); // not implemented yet. - } } // Src and dst can be any size. Src has 4 components. Dst has 3 components. @@ -659,7 +655,7 @@ void LLImageRaw::copyUnscaled(LLImageRaw* src) { LLImageRaw* dst = this; // Just for clarity. - llassert( (3 == src->getComponents()) || (4 == src->getComponents()) ); + llassert( (1 == src->getComponents()) || (3 == src->getComponents()) || (4 == src->getComponents()) ); llassert( src->getComponents() == dst->getComponents() ); llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ); @@ -742,7 +738,7 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) LLMemType mt1((LLMemType::EMemType)mMemType); LLImageRaw* dst = this; // Just for clarity. - llassert( (3 == src->getComponents()) || (4 == src->getComponents()) ); + llassert( (1 == src->getComponents()) || (3 == src->getComponents()) || (4 == src->getComponents()) ); llassert( src->getComponents() == dst->getComponents() ); if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ) @@ -773,7 +769,7 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) { LLMemType mt1((LLMemType::EMemType)mMemType); - llassert( (3 == getComponents()) || (4 == getComponents()) ); + llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) ); S32 old_width = getWidth(); S32 old_height = getHeight(); @@ -1063,7 +1059,7 @@ void LLImageRaw::compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S3 static struct { const char* exten; - S8 codec; + EImageCodec codec; } file_extensions[] = { @@ -1098,7 +1094,7 @@ static LLString find_file(LLString &name, S8 *codec) return LLString(""); } -static S8 get_codec(const LLString& exten) +EImageCodec LLImageBase::getCodecFromExtension(const LLString& exten) { for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++) { @@ -1121,7 +1117,7 @@ bool LLImageRaw::createFromFile(const LLString &filename, bool j2c_lowest_mip_on { exten = name.substr(dotidx+1); LLString::toLower(exten); - codec = get_codec(exten); + codec = getCodecFromExtension(exten); } else { @@ -1264,6 +1260,9 @@ LLImageFormatted* LLImageFormatted::createFromType(S8 codec) case IMG_CODEC_DXT: image = new LLImageDXT(); break; + case IMG_CODEC_PNG: + image = new LLImagePNG(); + break; default: image = NULL; break; @@ -1284,7 +1283,7 @@ LLImageFormatted* LLImageFormatted::createFromExtension(const LLString& instring { exten = instring; } - S8 codec = get_codec(exten); + S8 codec = getCodecFromExtension(exten); return createFromType(codec); } //---------------------------------------------------------------------------- diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 65a7c54a50..ca19198332 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -60,7 +60,7 @@ class LLImageFormatted; class LLImageRaw; class LLColor4U; -enum +typedef enum e_image_codec { IMG_CODEC_INVALID = 0, IMG_CODEC_RGB = 1, @@ -71,7 +71,7 @@ enum IMG_CODEC_DXT = 6, IMG_CODEC_PNG = 7, IMG_CODEC_EOF = 8 -}; +} EImageCodec; //============================================================================ @@ -124,6 +124,8 @@ public: static void setSizeOverride(BOOL enabled) { sSizeOverride = enabled; } + static EImageCodec getCodecFromExtension(const LLString& exten); + private: U8 *mData; S32 mDataSize; |