diff options
Diffstat (limited to 'indra/llimage')
| -rw-r--r-- | indra/llimage/llimage.cpp | 23 | ||||
| -rw-r--r-- | indra/llimage/llimagej2c.cpp | 12 | ||||
| -rw-r--r-- | indra/llimage/llimagej2c.h | 4 | 
3 files changed, 17 insertions, 22 deletions
| diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 39211bf7fa..f0d15d9607 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -1254,28 +1254,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip  		return false;  	} -	LLPointer<LLImageFormatted> image; -	switch(codec) -	{ -	  //case IMG_CODEC_RGB: -	  case IMG_CODEC_BMP: -		image = new LLImageBMP(); -		break; -	  case IMG_CODEC_TGA: -		image = new LLImageTGA(); -		break; -	  case IMG_CODEC_JPEG: -		image = new LLImageJPEG(); -		break; -	  case IMG_CODEC_J2C: -		image = new LLImageJ2C(); -		break; -	  case IMG_CODEC_DXT: -		image = new LLImageDXT(); -		break; -	  default: -		return false; -	} +	LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);  	llassert(image.notNull());  	U8 *buffer = image->allocateData(length); diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 80fec7f8a0..a90df0f1c1 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -139,6 +139,15 @@ BOOL LLImageJ2C::updateData()  	return res;  } +BOOL LLImageJ2C::initDecode(LLImageRaw &raw_image, int discard_level, int* region) +{ +	return mImpl->initDecode(*this,raw_image,discard_level,region); +} + +BOOL LLImageJ2C::initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size) +{ +	return mImpl->initEncode(*this,raw_image,blocks_size,precincts_size); +}  BOOL LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time)  { @@ -251,6 +260,9 @@ S32 LLImageJ2C::calcHeaderSizeJ2C()  //static  S32 LLImageJ2C::calcDataSizeJ2C(S32 w, S32 h, S32 comp, S32 discard_level, F32 rate)  { +	// Note: this only provides an *estimate* of the size in bytes of an image level +	// *TODO: find a way to read the true size (when available) and convey the fact +	// that the result is an estimate in the other cases  	if (rate <= 0.f) rate = .125f;  	while (discard_level > 0)  	{ diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index dd5bec8b2e..6bba81aab5 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -56,6 +56,8 @@ public:  	/*virtual*/ void resetLastError();  	/*virtual*/ void setLastError(const std::string& message, const std::string& filename = std::string()); +	BOOL initDecode(LLImageRaw &raw_image, int discard_level, int* region); +	BOOL initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size);  	// Encode with comment text   	BOOL encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time=0.0); @@ -117,6 +119,8 @@ protected:  	virtual BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) = 0;  	virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0,  							BOOL reversible=FALSE) = 0; +	virtual BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL) = 0; +	virtual BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1) = 0;  	friend class LLImageJ2C;  }; | 
