aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage/llimage.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/llimage/llimage.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/llimage/llimage.cpp')
-rw-r--r--linden/indra/llimage/llimage.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp
index bcd9463..3600cce 100644
--- a/linden/indra/llimage/llimage.cpp
+++ b/linden/indra/llimage/llimage.cpp
@@ -43,6 +43,7 @@
43#if JPEG_SUPPORT 43#if JPEG_SUPPORT
44#include "llimagejpeg.h" 44#include "llimagejpeg.h"
45#endif 45#endif
46#include "llimagepng.h"
46#include "llimagedxt.h" 47#include "llimagedxt.h"
47 48
48//--------------------------------------------------------------------------- 49//---------------------------------------------------------------------------
@@ -490,8 +491,8 @@ void LLImageRaw::composite( LLImageRaw* src )
490{ 491{
491 LLImageRaw* dst = this; // Just for clarity. 492 LLImageRaw* dst = this; // Just for clarity.
492 493
493 llassert( (3 == src->getComponents()) || (4 == src->getComponents()) ); 494 llassert(3 == src->getComponents());
494 llassert( (3 == dst->getComponents()) || (4 == dst->getComponents()) ); 495 llassert(3 == dst->getComponents());
495 496
496 if( 3 == dst->getComponents() ) 497 if( 3 == dst->getComponents() )
497 { 498 {
@@ -519,11 +520,6 @@ void LLImageRaw::composite( LLImageRaw* src )
519 } 520 }
520 } 521 }
521 } 522 }
522 else
523 {
524 // 4 == dst->mComponents
525 llassert(0); // not implemented yet.
526 }
527} 523}
528 524
529// Src and dst can be any size. Src has 4 components. Dst has 3 components. 525// Src and dst can be any size. Src has 4 components. Dst has 3 components.
@@ -689,7 +685,7 @@ void LLImageRaw::copyUnscaled(LLImageRaw* src)
689{ 685{
690 LLImageRaw* dst = this; // Just for clarity. 686 LLImageRaw* dst = this; // Just for clarity.
691 687
692 llassert( (3 == src->getComponents()) || (4 == src->getComponents()) ); 688 llassert( (1 == src->getComponents()) || (3 == src->getComponents()) || (4 == src->getComponents()) );
693 llassert( src->getComponents() == dst->getComponents() ); 689 llassert( src->getComponents() == dst->getComponents() );
694 llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ); 690 llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) );
695 691
@@ -772,7 +768,7 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
772 LLMemType mt1((LLMemType::EMemType)mMemType); 768 LLMemType mt1((LLMemType::EMemType)mMemType);
773 LLImageRaw* dst = this; // Just for clarity. 769 LLImageRaw* dst = this; // Just for clarity.
774 770
775 llassert( (3 == src->getComponents()) || (4 == src->getComponents()) ); 771 llassert( (1 == src->getComponents()) || (3 == src->getComponents()) || (4 == src->getComponents()) );
776 llassert( src->getComponents() == dst->getComponents() ); 772 llassert( src->getComponents() == dst->getComponents() );
777 773
778 if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ) 774 if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) )
@@ -803,7 +799,7 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
803void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) 799void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
804{ 800{
805 LLMemType mt1((LLMemType::EMemType)mMemType); 801 LLMemType mt1((LLMemType::EMemType)mMemType);
806 llassert( (3 == getComponents()) || (4 == getComponents()) ); 802 llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) );
807 803
808 S32 old_width = getWidth(); 804 S32 old_width = getWidth();
809 S32 old_height = getHeight(); 805 S32 old_height = getHeight();
@@ -1093,7 +1089,7 @@ void LLImageRaw::compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S3
1093static struct 1089static struct
1094{ 1090{
1095 const char* exten; 1091 const char* exten;
1096 S8 codec; 1092 EImageCodec codec;
1097} 1093}
1098file_extensions[] = 1094file_extensions[] =
1099{ 1095{
@@ -1128,7 +1124,7 @@ static LLString find_file(LLString &name, S8 *codec)
1128 return LLString(""); 1124 return LLString("");
1129} 1125}
1130 1126
1131static S8 get_codec(const LLString& exten) 1127EImageCodec LLImageBase::getCodecFromExtension(const LLString& exten)
1132{ 1128{
1133 for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++) 1129 for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++)
1134 { 1130 {
@@ -1151,7 +1147,7 @@ bool LLImageRaw::createFromFile(const LLString &filename, bool j2c_lowest_mip_on
1151 { 1147 {
1152 exten = name.substr(dotidx+1); 1148 exten = name.substr(dotidx+1);
1153 LLString::toLower(exten); 1149 LLString::toLower(exten);
1154 codec = get_codec(exten); 1150 codec = getCodecFromExtension(exten);
1155 } 1151 }
1156 else 1152 else
1157 { 1153 {
@@ -1294,6 +1290,9 @@ LLImageFormatted* LLImageFormatted::createFromType(S8 codec)
1294 case IMG_CODEC_DXT: 1290 case IMG_CODEC_DXT:
1295 image = new LLImageDXT(); 1291 image = new LLImageDXT();
1296 break; 1292 break;
1293 case IMG_CODEC_PNG:
1294 image = new LLImagePNG();
1295 break;
1297 default: 1296 default:
1298 image = NULL; 1297 image = NULL;
1299 break; 1298 break;
@@ -1314,7 +1313,7 @@ LLImageFormatted* LLImageFormatted::createFromExtension(const LLString& instring
1314 { 1313 {
1315 exten = instring; 1314 exten = instring;
1316 } 1315 }
1317 S8 codec = get_codec(exten); 1316 S8 codec = getCodecFromExtension(exten);
1318 return createFromType(codec); 1317 return createFromType(codec);
1319} 1318}
1320//---------------------------------------------------------------------------- 1319//----------------------------------------------------------------------------