diff options
-rw-r--r-- | indra/llimage/llimage.cpp | 54 | ||||
-rw-r--r-- | indra/llimage/llimage.h | 30 | ||||
-rw-r--r-- | indra/llimage/llimagebmp.cpp | 80 | ||||
-rw-r--r-- | indra/llimage/llimagebmp.h | 16 | ||||
-rw-r--r-- | indra/llimage/llimagedxt.cpp | 24 | ||||
-rw-r--r-- | indra/llimage/llimagedxt.h | 10 | ||||
-rw-r--r-- | indra/llimage/llimagej2c.cpp | 56 | ||||
-rw-r--r-- | indra/llimage/llimagej2c.h | 34 | ||||
-rw-r--r-- | indra/llimage/llimagejpeg.cpp | 66 | ||||
-rw-r--r-- | indra/llimage/llimagejpeg.h | 8 | ||||
-rw-r--r-- | indra/llimage/llimagepng.cpp | 26 | ||||
-rw-r--r-- | indra/llimage/llimagepng.h | 6 | ||||
-rw-r--r-- | indra/llimage/llimagetga.cpp | 130 | ||||
-rw-r--r-- | indra/llimage/llimagetga.h | 24 | ||||
-rw-r--r-- | indra/llimagej2coj/llimagej2coj.cpp | 34 | ||||
-rw-r--r-- | indra/llimagej2coj/llimagej2coj.h | 12 | ||||
-rw-r--r-- | indra/llkdu/llimagej2ckdu.cpp | 62 | ||||
-rw-r--r-- | indra/llkdu/llimagej2ckdu.h | 16 | ||||
-rw-r--r-- | indra/llkdu/tests/llimagej2ckdu_test.cpp | 40 |
19 files changed, 364 insertions, 364 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 08462c7834..109ef7e904 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -895,30 +895,30 @@ void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components) sGlobalRawMemory += getDataSize(); } -BOOL LLImageRaw::resize(U16 width, U16 height, S8 components) +bool LLImageRaw::resize(U16 width, U16 height, S8 components) { if ((getWidth() == width) && (getHeight() == height) && (getComponents() == components)) { - return TRUE; + return true; } // Reallocate the data buffer. deleteData(); allocateDataSize(width,height,components); - return TRUE; + return true; } -BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, - const U8 *data, U32 stride, BOOL reverse_y) +bool LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, + const U8 *data, U32 stride, bool reverse_y) { if (!getData()) { - return FALSE; + return false; } if (!data) { - return FALSE; + return false; } // Should do some simple bounds checking @@ -933,7 +933,7 @@ BOOL LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, data + from_offset, getComponents()*width); } - return TRUE; + return true; } void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) @@ -988,7 +988,7 @@ void LLImageRaw::verticalFlip() } -void LLImageRaw::expandToPowerOfTwo(S32 max_dim, BOOL scale_image) +void LLImageRaw::expandToPowerOfTwo(S32 max_dim, bool scale_image) { // Find new sizes S32 new_width = expandDimToPowerOfTwo(getWidth(), max_dim); @@ -997,7 +997,7 @@ void LLImageRaw::expandToPowerOfTwo(S32 max_dim, BOOL scale_image) scale( new_width, new_height, scale_image ); } -void LLImageRaw::contractToPowerOfTwo(S32 max_dim, BOOL scale_image) +void LLImageRaw::contractToPowerOfTwo(S32 max_dim, bool scale_image) { // Find new sizes S32 new_width = contractDimToPowerOfTwo(getWidth(), MIN_IMAGE_SIZE); @@ -1397,7 +1397,7 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) } -BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) +bool LLImageRaw::scale( S32 new_width, S32 new_height, bool scale_image_data ) { llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) ); @@ -1406,7 +1406,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) if( (old_width == new_width) && (old_height == new_height) ) { - return TRUE; // Nothing to do. + return true; // Nothing to do. } // Reallocate the data buffer. @@ -1441,7 +1441,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) U8 *new_data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), new_data_size); if(NULL == new_data) { - return FALSE; + return false; } bilinear_scale(getData(), old_width, old_height, getComponents(), old_width*getComponents(), new_data, new_width, new_height, getComponents(), new_width*getComponents()); @@ -1476,7 +1476,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) } } - return TRUE ; + return true ; } void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ) @@ -1795,7 +1795,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip ifs.read ((char*)buffer, length); ifs.close(); - BOOL success; + bool success; success = image->updateData(); if (success) @@ -1971,7 +1971,7 @@ S32 LLImageFormatted::calcDiscardLevelBytes(S32 bytes) //---------------------------------------------------------------------------- // Subclasses that can handle more than 4 channels should override this function. -BOOL LLImageFormatted::decodeChannels(LLImageRaw* raw_image,F32 decode_time, S32 first_channel, S32 max_channel) +bool LLImageFormatted::decodeChannels(LLImageRaw* raw_image,F32 decode_time, S32 first_channel, S32 max_channel) { llassert( (first_channel == 0) && (max_channel == 4) ); return decode( raw_image, decode_time ); // Loads first 4 channels by default. @@ -2022,7 +2022,7 @@ void LLImageFormatted::sanityCheck() //---------------------------------------------------------------------------- -BOOL LLImageFormatted::copyData(U8 *data, S32 size) +bool LLImageFormatted::copyData(U8 *data, S32 size) { if ( data && ((data != getData()) || (size != getDataSize())) ) { @@ -2030,7 +2030,7 @@ BOOL LLImageFormatted::copyData(U8 *data, S32 size) allocateData(size); memcpy(getData(), data, size); /* Flawfinder: ignore */ } - return TRUE; + return true; } // LLImageFormatted becomes the owner of data @@ -2066,7 +2066,7 @@ void LLImageFormatted::appendData(U8 *data, S32 size) //---------------------------------------------------------------------------- -BOOL LLImageFormatted::load(const std::string &filename, int load_size) +bool LLImageFormatted::load(const std::string &filename, int load_size) { resetLastError(); @@ -2077,12 +2077,12 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) if (!apr_file) { setLastError("Unable to open file for reading", filename); - return FALSE; + return false; } if (file_size == 0) { setLastError("File is empty",filename); - return FALSE; + return false; } // Constrain the load size to acceptable values @@ -2090,7 +2090,7 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) { load_size = file_size; } - BOOL res; + bool res; U8 *data = allocateData(load_size); apr_size_t bytes_read = load_size; apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read @@ -2098,7 +2098,7 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) { deleteData(); setLastError("Unable to read file",filename); - res = FALSE; + res = false; } else { @@ -2108,7 +2108,7 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) return res; } -BOOL LLImageFormatted::save(const std::string &filename) +bool LLImageFormatted::save(const std::string &filename) { resetLastError(); @@ -2117,15 +2117,15 @@ BOOL LLImageFormatted::save(const std::string &filename) if (!outfile.getFileHandle()) { setLastError("Unable to open file for writing", filename); - return FALSE; + return false; } outfile.write(getData(), getDataSize()); outfile.close() ; - return TRUE; + return true; } -// BOOL LLImageFormatted::save(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type) +// bool LLImageFormatted::save(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type) // Depricated to remove VFS dependency. // Use: // LLVFile::writeFile(image->getData(), image->getDataSize(), vfs, uuid, type); diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index cd3f76f1fd..adc650d360 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -199,11 +199,11 @@ public: /*virtual*/ U8* allocateData(S32 size = -1); /*virtual*/ U8* reallocateData(S32 size); - BOOL resize(U16 width, U16 height, S8 components); + bool resize(U16 width, U16 height, S8 components); //U8 * getSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height) const; - BOOL setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, - const U8 *data, U32 stride = 0, BOOL reverse_y = FALSE); + bool setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, + const U8 *data, U32 stride = 0, bool reverse_y = false); void clear(U8 r=0, U8 g=0, U8 b=0, U8 a=255); @@ -212,10 +212,10 @@ public: static S32 biasedDimToPowerOfTwo(S32 curr_dim, S32 max_dim = MAX_IMAGE_SIZE); static S32 expandDimToPowerOfTwo(S32 curr_dim, S32 max_dim = MAX_IMAGE_SIZE); static S32 contractDimToPowerOfTwo(S32 curr_dim, S32 min_dim = MIN_IMAGE_SIZE); - void expandToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE); - void contractToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE); + void expandToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, bool scale_image = true); + void contractToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, bool scale_image = true); void biasedScaleToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE); - BOOL scale( S32 new_width, S32 new_height, BOOL scale_image = TRUE ); + bool scale( S32 new_width, S32 new_height, bool scale_image = true ); // Fill the buffer with a constant color void fill( const LLColor4U& color ); @@ -314,23 +314,23 @@ public: // getRawDiscardLevel() by default returns mDiscardLevel, but may be overridden (LLImageJ2C) virtual S8 getRawDiscardLevel() { return mDiscardLevel; } - BOOL load(const std::string& filename, int load_size = 0); - BOOL save(const std::string& filename); + bool load(const std::string& filename, int load_size = 0); + bool save(const std::string& filename); - virtual BOOL updateData() = 0; // pure virtual + virtual bool updateData() = 0; // pure virtual void setData(U8 *data, S32 size); void appendData(U8 *data, S32 size); // Loads first 4 channels. - virtual BOOL decode(LLImageRaw* raw_image, F32 decode_time) = 0; + virtual bool decode(LLImageRaw* raw_image, F32 decode_time) = 0; // Subclasses that can handle more than 4 channels should override this function. - virtual BOOL decodeChannels(LLImageRaw* raw_image, F32 decode_time, S32 first_channel, S32 max_channel); + virtual bool decodeChannels(LLImageRaw* raw_image, F32 decode_time, S32 first_channel, S32 max_channel); - virtual BOOL encode(const LLImageRaw* raw_image, F32 encode_time) = 0; + virtual bool encode(const LLImageRaw* raw_image, F32 encode_time) = 0; S8 getCodec() const; - BOOL isDecoding() const { return mDecoding ? TRUE : FALSE; } - BOOL isDecoded() const { return mDecoded ? TRUE : FALSE; } + bool isDecoding() const { return mDecoding; } + bool isDecoded() const { return mDecoded; } void setDiscardLevel(S8 discard_level) { mDiscardLevel = discard_level; } S8 getDiscardLevel() const { return mDiscardLevel; } S8 getLevels() const { return mLevels; } @@ -341,7 +341,7 @@ public: virtual void setLastError(const std::string& message, const std::string& filename = std::string()); protected: - BOOL copyData(U8 *data, S32 size); // calls updateData() + bool copyData(U8 *data, S32 size); // calls updateData() protected: S8 mCodec; diff --git a/indra/llimage/llimagebmp.cpp b/indra/llimage/llimagebmp.cpp index a2ce2fee86..2cdd26c22b 100644 --- a/indra/llimage/llimagebmp.cpp +++ b/indra/llimage/llimagebmp.cpp @@ -78,7 +78,7 @@ LLImageBMP::LLImageBMP() mColorPalette( NULL ), mBitmapOffset( 0 ), mBitsPerPixel( 0 ), - mOriginAtTop( FALSE ) + mOriginAtTop( false ) { mBitfieldMask[0] = 0; mBitfieldMask[1] = 0; @@ -92,7 +92,7 @@ LLImageBMP::~LLImageBMP() } -BOOL LLImageBMP::updateData() +bool LLImageBMP::updateData() { resetLastError(); @@ -101,7 +101,7 @@ BOOL LLImageBMP::updateData() if (!mdata || (0 == getDataSize())) { setLastError("Uninitialized instance of LLImageBMP"); - return FALSE; + return false; } // Read the bitmap headers in order to get all the useful info @@ -120,12 +120,12 @@ BOOL LLImageBMP::updateData() if ((mdata[0] != 'B') || (mdata[1] != 'A')) { setLastError("OS/2 bitmap array BMP files are not supported"); - return FALSE; + return false; } else { setLastError("Does not appear to be a bitmap file"); - return FALSE; + return false; } } @@ -160,12 +160,12 @@ BOOL LLImageBMP::updateData() llendianswizzleone(header.mNumColors); llendianswizzleone(header.mNumColorsImportant); - BOOL windows_nt_version = FALSE; - BOOL windows_95_version = FALSE; + bool windows_nt_version = false; + bool windows_95_version = false; if( 12 == header.mSize ) { setLastError("Windows 2.x and OS/2 1.x BMP files are not supported"); - return FALSE; + return false; } else if( 40 == header.mSize ) @@ -173,7 +173,7 @@ BOOL LLImageBMP::updateData() if( 3 == header.mCompression ) { // Windows NT - windows_nt_version = TRUE; + windows_nt_version = true; } else { @@ -184,32 +184,32 @@ BOOL LLImageBMP::updateData() if( 12 <= header.mSize && 64 <= header.mSize ) { setLastError("OS/2 2.x BMP files are not supported"); - return FALSE; + return false; } else if( 108 == header.mSize ) { // BITMAPV4HEADER - windows_95_version = TRUE; + windows_95_version = true; } else if( 108 < header.mSize ) { // BITMAPV5HEADER or greater // Should work as long at Microsoft maintained backwards compatibility (which they did in V4 and V5) - windows_95_version = TRUE; + windows_95_version = true; } S32 width = header.mWidth; S32 height = header.mHeight; if (height < 0) { - mOriginAtTop = TRUE; + mOriginAtTop = true; height = -height; } else { - mOriginAtTop = FALSE; + mOriginAtTop = false; } mBitsPerPixel = header.mBitsPerPixel; @@ -228,10 +228,10 @@ BOOL LLImageBMP::updateData() case 16: // Started work on 16, but doesn't work yet // These are legal, but we don't support them yet. setLastError("Unsupported bit depth"); - return FALSE; + return false; default: setLastError("Unrecognized bit depth"); - return FALSE; + return false; } setSize(width, height, components); @@ -244,11 +244,11 @@ BOOL LLImageBMP::updateData() case 1: setLastError("8 bit RLE compression not supported."); - return FALSE; + return false; case 2: setLastError("4 bit RLE compression not supported."); - return FALSE; + return false; case 3: // Windows NT or Windows 95 @@ -256,7 +256,7 @@ BOOL LLImageBMP::updateData() default: setLastError("Unsupported compression format."); - return FALSE; + return false; } //////////////////////////////////////////////////////////////////// @@ -267,13 +267,13 @@ BOOL LLImageBMP::updateData() if( (16 != header.mBitsPerPixel) && (32 != header.mBitsPerPixel) ) { setLastError("Bitfield encoding requires 16 or 32 bits per pixel."); - return FALSE; + return false; } if( 0 != header.mNumColors ) { setLastError("Bitfield encoding is not compatible with a color table."); - return FALSE; + return false; } @@ -322,15 +322,15 @@ BOOL LLImageBMP::updateData() if (!mColorPalette) { LL_ERRS() << "Out of memory in LLImageBMP::updateData()" << LL_ENDL; - return FALSE; + return false; } memcpy( mColorPalette, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE + extension_size, color_palette_size ); /* Flawfinder: ignore */ } - return TRUE; + return true; } -BOOL LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) +bool LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); @@ -341,7 +341,7 @@ BOOL LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) if (!mdata || (0 == getDataSize())) { setLastError("llimagebmp trying to decode an image with no data!"); - return FALSE; + return false; } raw_image->resize(getWidth(), getHeight(), 3); @@ -349,7 +349,7 @@ BOOL LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time) U8* src = mdata + mBitmapOffset; U8* dst = raw_image->getData(); - BOOL success = FALSE; + bool success = false; switch( mBitsPerPixel ) { @@ -393,7 +393,7 @@ U32 LLImageBMP::countTrailingZeros( U32 m ) } -BOOL LLImageBMP::decodeColorMask16( U8* dst, U8* src ) +bool LLImageBMP::decodeColorMask16( U8* dst, U8* src ) { llassert( 16 == mBitsPerPixel ); @@ -426,10 +426,10 @@ BOOL LLImageBMP::decodeColorMask16( U8* dst, U8* src ) src += alignment_bytes; } - return TRUE; + return true; } -BOOL LLImageBMP::decodeColorMask32( U8* dst, U8* src ) +bool LLImageBMP::decodeColorMask32( U8* dst, U8* src ) { // Note: alpha is not supported @@ -445,7 +445,7 @@ BOOL LLImageBMP::decodeColorMask32( U8* dst, U8* src ) if (getWidth() * getHeight() * 4 > getDataSize() - mBitmapOffset) { //here we have situation when data size in src less than actually needed - return FALSE; + return false; } S32 src_row_span = getWidth() * 4; @@ -469,11 +469,11 @@ BOOL LLImageBMP::decodeColorMask32( U8* dst, U8* src ) src += alignment_bytes; } - return TRUE; + return true; } -BOOL LLImageBMP::decodeColorTable8( U8* dst, U8* src ) +bool LLImageBMP::decodeColorTable8( U8* dst, U8* src ) { llassert( (8 == mBitsPerPixel) && (mColorPaletteColors >= 256) ); @@ -482,7 +482,7 @@ BOOL LLImageBMP::decodeColorTable8( U8* dst, U8* src ) if ((getWidth() * getHeight()) + getHeight() * alignment_bytes > getDataSize() - mBitmapOffset) { //here we have situation when data size in src less than actually needed - return FALSE; + return false; } for( S32 row = 0; row < getHeight(); row++ ) @@ -499,11 +499,11 @@ BOOL LLImageBMP::decodeColorTable8( U8* dst, U8* src ) src += alignment_bytes; } - return TRUE; + return true; } -BOOL LLImageBMP::decodeTruecolor24( U8* dst, U8* src ) +bool LLImageBMP::decodeTruecolor24( U8* dst, U8* src ) { llassert( 24 == mBitsPerPixel ); llassert( 3 == getComponents() ); @@ -512,7 +512,7 @@ BOOL LLImageBMP::decodeTruecolor24( U8* dst, U8* src ) if ((getWidth() * getHeight() * 3) + getHeight() * alignment_bytes > getDataSize() - mBitmapOffset) { //here we have situation when data size in src less than actually needed - return FALSE; + return false; } for( S32 row = 0; row < getHeight(); row++ ) @@ -528,10 +528,10 @@ BOOL LLImageBMP::decodeTruecolor24( U8* dst, U8* src ) src += alignment_bytes; } - return TRUE; + return true; } -BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) +bool LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) { llassert_always(raw_image); @@ -563,7 +563,7 @@ BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) // Allocate the new buffer for the data. if(!allocateData(file_bytes)) //memory allocation failed { - return FALSE ; + return false ; } magic[0] = 'B'; magic[1] = 'M'; @@ -663,5 +663,5 @@ BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) } } - return TRUE; + return true; } diff --git a/indra/llimage/llimagebmp.h b/indra/llimage/llimagebmp.h index db0b45def0..6a5fa4697d 100644 --- a/indra/llimage/llimagebmp.h +++ b/indra/llimage/llimagebmp.h @@ -40,15 +40,15 @@ public: LLImageBMP(); /*virtual*/ std::string getExtension() { return std::string("bmp"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time); protected: - BOOL decodeColorTable8( U8* dst, U8* src ); - BOOL decodeColorMask16( U8* dst, U8* src ); - BOOL decodeTruecolor24( U8* dst, U8* src ); - BOOL decodeColorMask32( U8* dst, U8* src ); + bool decodeColorTable8( U8* dst, U8* src ); + bool decodeColorMask16( U8* dst, U8* src ); + bool decodeTruecolor24( U8* dst, U8* src ); + bool decodeColorMask32( U8* dst, U8* src ); U32 countTrailingZeros( U32 m ); @@ -58,7 +58,7 @@ protected: S32 mBitmapOffset; S32 mBitsPerPixel; U32 mBitfieldMask[4]; // rgba - BOOL mOriginAtTop; + bool mOriginAtTop; }; #endif diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp index 04e0e752eb..0ec83415a0 100644 --- a/indra/llimage/llimagedxt.cpp +++ b/indra/llimage/llimagedxt.cpp @@ -172,7 +172,7 @@ LLImageDXT::~LLImageDXT() } // virtual -BOOL LLImageDXT::updateData() +bool LLImageDXT::updateData() { resetLastError(); @@ -182,7 +182,7 @@ BOOL LLImageDXT::updateData() if (!data || !data_size) { setLastError("LLImageDXT uninitialized"); - return FALSE; + return false; } S32 width, height, miplevelmax; @@ -216,7 +216,7 @@ BOOL LLImageDXT::updateData() discard = llmin(discard, miplevelmax); setDiscardLevel(discard); - return TRUE; + return true; } // discard: 0 = largest (last) mip @@ -257,7 +257,7 @@ void LLImageDXT::setFormat() } // virtual -BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) +bool LLImageDXT::decode(LLImageRaw* raw_image, F32 time) { // *TODO: Test! This has been tweaked since its intial inception, // but we don't use it any more! @@ -266,7 +266,7 @@ BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) if (mFileFormat >= FORMAT_DXT1 && mFileFormat <= FORMAT_DXR5) { LL_WARNS() << "Attempt to decode compressed LLImageDXT to Raw (unsupported)" << LL_ENDL; - return FALSE; + return false; } S32 width = getWidth(), height = getHeight(); @@ -286,16 +286,16 @@ BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) if ((!getData()) || (data + image_size > getData() + getDataSize())) { setLastError("LLImageDXT trying to decode an image with not enough data!"); - return FALSE; + return false; } raw_image->resize(width, height, ncomponents); memcpy(raw_image->getData(), data, image_size); /* Flawfinder: ignore */ - return TRUE; + return true; } -BOOL LLImageDXT::getMipData(LLPointer<LLImageRaw>& raw, S32 discard) +bool LLImageDXT::getMipData(LLPointer<LLImageRaw>& raw, S32 discard) { if (discard < 0) { @@ -310,10 +310,10 @@ BOOL LLImageDXT::getMipData(LLPointer<LLImageRaw>& raw, S32 discard) S32 height = 0; calcDiscardWidthHeight(discard, mFileFormat, width, height); raw = new LLImageRaw(data, width, height, getComponents()); - return TRUE; + return true; } -BOOL LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_mips) +bool LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_mips) { llassert_always(raw_image); @@ -395,11 +395,11 @@ BOOL LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_ prev_mipdata = mipdata; } - return TRUE; + return true; } // virtual -BOOL LLImageDXT::encode(const LLImageRaw* raw_image, F32 time) +bool LLImageDXT::encode(const LLImageRaw* raw_image, F32 time) { return encodeDXT(raw_image, time, false); } diff --git a/indra/llimage/llimagedxt.h b/indra/llimage/llimagedxt.h index a8756ba8ed..a4a9bcf99c 100644 --- a/indra/llimage/llimagedxt.h +++ b/indra/llimage/llimagedxt.h @@ -93,21 +93,21 @@ protected: /*virtual*/ ~LLImageDXT(); private: - BOOL encodeDXT(const LLImageRaw* raw_image, F32 decode_time, bool explicit_mips); + bool encodeDXT(const LLImageRaw* raw_image, F32 decode_time, bool explicit_mips); public: LLImageDXT(); /*virtual*/ std::string getExtension() { return std::string("dxt"); } - /*virtual*/ BOOL updateData(); + /*virtual*/ bool updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time); /*virtual*/ S32 calcHeaderSize(); /*virtual*/ S32 calcDataSize(S32 discard_level = 0); - BOOL getMipData(LLPointer<LLImageRaw>& raw, S32 discard=-1); + bool getMipData(LLPointer<LLImageRaw>& raw, S32 discard=-1); void setFormat(); S32 getMipOffset(S32 discard); diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 913313bf15..68694496bc 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -56,7 +56,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), mMaxBytes(0), mRawDiscardLevel(-1), mRate(DEFAULT_COMPRESSION_RATE), - mReversible(FALSE), + mReversible(false), mAreaUsedForDataSizeCalcs(0) { mImpl.reset(fallbackCreateLLImageJ2CImpl()); @@ -103,16 +103,16 @@ S8 LLImageJ2C::getRawDiscardLevel() return mRawDiscardLevel; } -BOOL LLImageJ2C::updateData() +bool LLImageJ2C::updateData() { - BOOL res = TRUE; + bool res = true; resetLastError(); // Check to make sure that this instance has been initialized with data if (!getData() || (getDataSize() < 16)) { setLastError("LLImageJ2C uninitialized"); - res = FALSE; + res = false; } else { @@ -134,29 +134,29 @@ BOOL LLImageJ2C::updateData() return res; } -BOOL LLImageJ2C::initDecode(LLImageRaw &raw_image, int discard_level, int* region) +bool LLImageJ2C::initDecode(LLImageRaw &raw_image, int discard_level, int* region) { setDiscardLevel(discard_level != -1 ? discard_level : 0); return mImpl->initDecode(*this,raw_image,discard_level,region); } -BOOL LLImageJ2C::initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) +bool LLImageJ2C::initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) { return mImpl->initEncode(*this,raw_image,blocks_size,precincts_size,levels); } -BOOL LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time) +bool LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time) { return decodeChannels(raw_imagep, decode_time, 0, 4); } -// Returns TRUE to mean done, whether successful or not. -BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count ) +// Returns true to mean done, whether successful or not. +bool LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count ) { LLTimer elapsed; - BOOL res = TRUE; + bool res = true; resetLastError(); @@ -164,13 +164,13 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir if (!getData() || (getDataSize() < 16)) { setLastError("LLImageJ2C uninitialized"); - res = TRUE; // done + res = true; // done } else { // Update the raw discard level updateRawDiscardLevel(); - mDecoding = TRUE; + mDecoding = true; res = mImpl->decodeImpl(*this, *raw_imagep, decode_time, first_channel, max_channel_count); } @@ -183,7 +183,7 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir } else { - mDecoding = FALSE; + mDecoding = false; } } @@ -202,7 +202,7 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir tester->updateDecompressionStats(elapsed.getElapsedTimeF32()) ; if (res) { - // The whole data stream is finally decompressed when res is returned as TRUE + // The whole data stream is finally decompressed when res is returned as true tester->updateDecompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ; } } @@ -211,17 +211,17 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir } -BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, F32 encode_time) +bool LLImageJ2C::encode(const LLImageRaw *raw_imagep, F32 encode_time) { return encode(raw_imagep, NULL, encode_time); } -BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time) +bool LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time) { LLTimer elapsed; resetLastError(); - BOOL res = mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time, mReversible); + bool res = mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time, mReversible); if (!mLastError.empty()) { LLImage::setLastError(mLastError); @@ -237,7 +237,7 @@ BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, tester->updateCompressionStats(elapsed.getElapsedTimeF32()) ; if (res) { - // The whole data stream is finally compressed when res is returned as TRUE + // The whole data stream is finally compressed when res is returned as true tester->updateCompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ; } } @@ -340,15 +340,15 @@ void LLImageJ2C::setMaxBytes(S32 max_bytes) mMaxBytes = max_bytes; } -void LLImageJ2C::setReversible(const BOOL reversible) +void LLImageJ2C::setReversible(const bool reversible) { mReversible = reversible; } -BOOL LLImageJ2C::loadAndValidate(const std::string &filename) +bool LLImageJ2C::loadAndValidate(const std::string &filename) { - BOOL res = TRUE; + bool res = true; resetLastError(); @@ -359,12 +359,12 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) if (!apr_file) { setLastError("Unable to open file for reading", filename); - res = FALSE; + res = false; } else if (file_size == 0) { setLastError("File is empty",filename); - res = FALSE; + res = false; } else { @@ -377,7 +377,7 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) { FREE_MEM(LLImageBase::getPrivatePool(), data); setLastError("Unable to read entire file"); - res = FALSE; + res = false; } else { @@ -394,21 +394,21 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) } -BOOL LLImageJ2C::validate(U8 *data, U32 file_size) +bool LLImageJ2C::validate(U8 *data, U32 file_size) { resetLastError(); setData(data, file_size); - BOOL res = updateData(); + bool res = updateData(); if ( res ) { // Check to make sure that this instance has been initialized with data if (!getData() || (0 == getDataSize())) { setLastError("LLImageJ2C uninitialized"); - res = FALSE; + res = false; } else { @@ -425,7 +425,7 @@ BOOL LLImageJ2C::validate(U8 *data, U32 file_size) void LLImageJ2C::decodeFailed() { - mDecoding = FALSE; + mDecoding = false; } void LLImageJ2C::updateRawDiscardLevel() diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index bfaccdfd05..44aff98494 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -48,10 +48,10 @@ public: // Base class overrides /*virtual*/ std::string getExtension() { return std::string("j2c"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw *raw_imagep, F32 decode_time); - /*virtual*/ BOOL decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count); - /*virtual*/ BOOL encode(const LLImageRaw *raw_imagep, F32 encode_time); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw *raw_imagep, F32 decode_time); + /*virtual*/ bool decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count); + /*virtual*/ bool encode(const LLImageRaw *raw_imagep, F32 encode_time); /*virtual*/ S32 calcHeaderSize(); /*virtual*/ S32 calcDataSize(S32 discard_level = 0); /*virtual*/ S32 calcDiscardLevelBytes(S32 bytes); @@ -60,17 +60,17 @@ 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, int levels); + bool initDecode(LLImageRaw &raw_image, int discard_level, int* region); + bool initEncode(LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels); // Encode with comment text - BOOL encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time=0.0); + bool encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time=0.0); - BOOL validate(U8 *data, U32 file_size); - BOOL loadAndValidate(const std::string &filename); + bool validate(U8 *data, U32 file_size); + bool loadAndValidate(const std::string &filename); // Encode accessors - void setReversible(const BOOL reversible); // Use non-lossy? + void setReversible(const bool reversible); // Use non-lossy? void setMaxBytes(S32 max_bytes); S32 getMaxBytes() const { return mMaxBytes; } @@ -94,7 +94,7 @@ protected: S8 mRawDiscardLevel; F32 mRate; - BOOL mReversible; + bool mReversible; boost::scoped_ptr<LLImageJ2CImpl> mImpl; std::string mLastError; @@ -112,18 +112,18 @@ protected: // Return value: // true: image size and number of channels was determined // false: error on decode - virtual BOOL getMetadata(LLImageJ2C &base) = 0; + virtual bool getMetadata(LLImageJ2C &base) = 0; // Decode the raw image optionally aborting (to continue later) after // decode_time seconds. Decode at most max_channel_count and start // decoding channel first_channel. // Return value: // true: decoding complete (even if it failed) // false: time expired while decoding - 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, int levels = 0) = 0; + 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, int levels = 0) = 0; virtual std::string getEngineInfo() const = 0; diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp index e419c77ff2..60b2d0faa5 100644 --- a/indra/llimage/llimagejpeg.cpp +++ b/indra/llimage/llimagejpeg.cpp @@ -45,7 +45,7 @@ LLImageJPEG::~LLImageJPEG() delete[] mOutputBuffer; } -BOOL LLImageJPEG::updateData() +bool LLImageJPEG::updateData() { resetLastError(); @@ -53,7 +53,7 @@ BOOL LLImageJPEG::updateData() if (!getData() || (0 == getDataSize())) { setLastError("Uninitialized instance of LLImageJPEG"); - return FALSE; + return false; } //////////////////////////////////////// @@ -79,7 +79,7 @@ BOOL LLImageJPEG::updateData() if(setjmp(sSetjmpBuffer)) { jpeg_destroy_decompress(&cinfo); - return FALSE; + return false; } try { @@ -106,7 +106,7 @@ BOOL LLImageJPEG::updateData() //////////////////////////////////////// // Step 3: read file parameters with jpeg_read_header() - jpeg_read_header( &cinfo, TRUE ); + jpeg_read_header( &cinfo, true ); // Data set by jpeg_read_header setSize(cinfo.image_width, cinfo.image_height, 3); // Force to 3 components (RGB) @@ -115,13 +115,13 @@ BOOL LLImageJPEG::updateData() // More data set by jpeg_read_header cinfo.num_components; cinfo.jpeg_color_space; // Colorspace of image - cinfo.saw_JFIF_marker; // TRUE if a JFIF APP0 marker was seen + cinfo.saw_JFIF_marker; // true if a JFIF APP0 marker was seen cinfo.JFIF_major_version; // Version information from JFIF marker cinfo.JFIF_minor_version; // cinfo.density_unit; // Resolution data from JFIF marker cinfo.X_density; cinfo.Y_density; - cinfo.saw_Adobe_marker; // TRUE if an Adobe APP14 marker was seen + cinfo.saw_Adobe_marker; // true if an Adobe APP14 marker was seen cinfo.Adobe_transform; // Color transform code from Adobe marker */ } @@ -129,13 +129,13 @@ BOOL LLImageJPEG::updateData() { jpeg_destroy_decompress(&cinfo); - return FALSE; + return false; } //////////////////////////////////////// // Step 4: Release JPEG decompression object jpeg_destroy_decompress(&cinfo); - return TRUE; + return true; } // Initialize source --- called by jpeg_read_header @@ -154,7 +154,7 @@ boolean LLImageJPEG::decodeFillInputBuffer( j_decompress_ptr cinfo ) // Should never get here, since we provide the entire buffer up front. ERREXIT(cinfo, JERR_INPUT_EMPTY); - return TRUE; + return true; } // Skip data --- used to skip over a potentially large amount of @@ -182,7 +182,7 @@ void LLImageJPEG::decodeTermSource (j_decompress_ptr cinfo) // Returns true when done, whether or not decode was successful. -BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) +bool LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); @@ -192,7 +192,7 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) if (!getData() || (0 == getDataSize())) { setLastError("LLImageJPEG trying to decode an image with no data!"); - return TRUE; // done + return true; // done } S32 row_stride = 0; @@ -220,7 +220,7 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) if(setjmp(sSetjmpBuffer)) { jpeg_destroy_decompress(&cinfo); - return TRUE; // done + return true; // done } try { @@ -247,11 +247,11 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) //////////////////////////////////////// // Step 3: read file parameters with jpeg_read_header() - jpeg_read_header(&cinfo, TRUE); + jpeg_read_header(&cinfo, true); // We can ignore the return value from jpeg_read_header since // (a) suspension is not possible with our data source, and - // (b) we passed TRUE to reject a tables-only JPEG file as an error. + // (b) we passed true to reject a tables-only JPEG file as an error. // See libjpeg.doc for more info. setSize(cinfo.image_width, cinfo.image_height, 3); // Force to 3 components (RGB) @@ -314,7 +314,7 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) catch (int) { jpeg_destroy_decompress(&cinfo); - return TRUE; // done + return true; // done } // Check to see whether any corrupt-data warnings occurred @@ -322,10 +322,10 @@ BOOL LLImageJPEG::decode(LLImageRaw* raw_image, F32 decode_time) { // TODO: extract the warning to find out what went wrong. setLastError( "Unable to decode JPEG image."); - return TRUE; // done + return true; // done } - return TRUE; + return true; } @@ -344,11 +344,11 @@ void LLImageJPEG::encodeInitDestination ( j_compress_ptr cinfo ) // // In typical applications, this should write the entire output buffer // (ignoring the current state of next_output_byte & free_in_buffer), -// reset the pointer & count to the start of the buffer, and return TRUE +// reset the pointer & count to the start of the buffer, and return true // indicating that the buffer has been dumped. // // In applications that need to be able to suspend compression due to output -// overrun, a FALSE return indicates that the buffer cannot be emptied now. +// overrun, a false return indicates that the buffer cannot be emptied now. // In this situation, the compressor will return to its caller (possibly with // an indication that it has not accepted all the supplied scanlines). The // application should resume compression after it has made more room in the @@ -357,7 +357,7 @@ void LLImageJPEG::encodeInitDestination ( j_compress_ptr cinfo ) // // When suspending, the compressor will back up to a convenient restart point // (typically the start of the current MCU). next_output_byte & free_in_buffer -// indicate where the restart point will be if the current call returns FALSE. +// indicate where the restart point will be if the current call returns false. // Data beyond this point will be regenerated after resumption, so do not // write it out when emptying the buffer externally. @@ -374,7 +374,7 @@ boolean LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo ) if (!new_buffer) { LL_ERRS() << "Out of memory in LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo )" << LL_ENDL; - return FALSE; + return false; } memcpy( new_buffer, self->mOutputBuffer, self->mOutputBufferSize ); /* Flawfinder: ignore */ delete[] self->mOutputBuffer; @@ -386,7 +386,7 @@ boolean LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo ) self->mOutputBufferSize = new_buffer_size; self->claimMem(new_buffer_size); - return TRUE; + return true; } // Terminate destination --- called by jpeg_finish_compress @@ -465,11 +465,11 @@ void LLImageJPEG::errorOutputMessage( j_common_ptr cinfo ) std::string error = buffer ; LLImage::setLastError(error); - BOOL is_decode = (cinfo->is_decompressor != 0); + bool is_decode = (cinfo->is_decompressor != 0); LL_WARNS() << "LLImageJPEG " << (is_decode ? "decode " : "encode ") << " failed: " << buffer << LL_ENDL; } -BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) +bool LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) { llassert_always(raw_image); @@ -482,7 +482,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) break; default: setLastError("Unable to encode a JPEG image that doesn't have 1 or 3 components."); - return FALSE; + return false; } setSize(raw_image->getWidth(), raw_image->getHeight(), raw_image->getComponents()); @@ -531,7 +531,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) mOutputBuffer = NULL; disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; - return FALSE; + return false; } try @@ -576,7 +576,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) break; default: setLastError("Unable to encode a JPEG image that doesn't have 1 or 3 components."); - return FALSE; + return false; } // Now use the library's routine to set default compression parameters. @@ -585,15 +585,15 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) jpeg_set_defaults(&cinfo); // Now you can set any non-default parameters you wish to. - jpeg_set_quality(&cinfo, mEncodeQuality, TRUE ); // limit to baseline-JPEG values + jpeg_set_quality(&cinfo, mEncodeQuality, true ); // limit to baseline-JPEG values //////////////////////////////////////// // Step 4: Start compressor // - // TRUE ensures that we will write a complete interchange-JPEG file. - // Pass TRUE unless you are very sure of what you're doing. + // true ensures that we will write a complete interchange-JPEG file. + // Pass true unless you are very sure of what you're doing. - jpeg_start_compress(&cinfo, TRUE); + jpeg_start_compress(&cinfo, true); //////////////////////////////////////// // Step 5: while (scan lines remain to be written) @@ -647,8 +647,8 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) mOutputBuffer = NULL; disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index 2142660c81..7a849a8421 100644 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -51,9 +51,9 @@ public: LLImageJPEG(S32 quality = 75); /*virtual*/ std::string getExtension() { return std::string("jpg"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time); void setEncodeQuality( S32 q ) { mEncodeQuality = q; } // on a scale from 1 to 100 S32 getEncodeQuality() { return mEncodeQuality; } @@ -73,7 +73,7 @@ public: static void errorEmitMessage(j_common_ptr cinfo, int msg_level); static void errorOutputMessage(j_common_ptr cinfo); - static BOOL decompress(LLImageJPEG* imagep); + static bool decompress(LLImageJPEG* imagep); protected: U8* mOutputBuffer; // temp buffer used during encoding diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index 7735dc1379..a299602d79 100644 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -47,7 +47,7 @@ LLImagePNG::~LLImagePNG() // Virtual // Parse PNG image information and set the appropriate // width, height and component (channel) information. -BOOL LLImagePNG::updateData() +bool LLImagePNG::updateData() { resetLastError(); @@ -55,7 +55,7 @@ BOOL LLImagePNG::updateData() if (!getData() || (0 == getDataSize())) { setLastError("Uninitialized instance of LLImagePNG"); - return FALSE; + return false; } // Decode the PNG data and extract sizing information @@ -63,25 +63,25 @@ BOOL LLImagePNG::updateData() if (!pngWrapper.isValidPng(getData())) { setLastError("LLImagePNG data does not have a valid PNG header!"); - return FALSE; + return false; } LLPngWrapper::ImageInfo infop; if (! pngWrapper.readPng(getData(), getDataSize(), NULL, &infop)) { setLastError(pngWrapper.getErrorMessage()); - return FALSE; + return false; } setSize(infop.mWidth, infop.mHeight, infop.mComponents); - return TRUE; + return true; } // Virtual // Decode an in-memory PNG image into the raw RGB or RGBA format // used within SecondLife. -BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) +bool LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); @@ -91,7 +91,7 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) if (!getData() || (0 == getDataSize())) { setLastError("LLImagePNG trying to decode an image with no data!"); - return FALSE; + return false; } // Decode the PNG data into the raw image @@ -99,21 +99,21 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) if (!pngWrapper.isValidPng(getData())) { setLastError("LLImagePNG data does not have a valid PNG header!"); - return FALSE; + return false; } if (! pngWrapper.readPng(getData(), getDataSize(), raw_image)) { setLastError(pngWrapper.getErrorMessage()); - return FALSE; + return false; } - return TRUE; + return true; } // Virtual // Encode the in memory RGB image into PNG format. -BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) +bool LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) { llassert_always(raw_image); @@ -133,7 +133,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) { setLastError(pngWrapper.getErrorMessage()); delete[] tmpWriteBuffer; - return FALSE; + return false; } // Resize internal buffer and copy from temp @@ -143,6 +143,6 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) delete[] tmpWriteBuffer; - return TRUE; + return true; } diff --git a/indra/llimage/llimagepng.h b/indra/llimage/llimagepng.h index 1fbd850a2e..ef16f2996f 100644 --- a/indra/llimage/llimagepng.h +++ b/indra/llimage/llimagepng.h @@ -38,9 +38,9 @@ public: LLImagePNG(); /*virtual*/ std::string getExtension() { return std::string("png"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time); }; #endif diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index d0ae105ba7..5ad7658ec1 100644 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -61,7 +61,7 @@ LLImageTGA::LLImageTGA() mColorMapStart( 0 ), mColorMapLength( 0 ), mColorMapBytesPerEntry( 0 ), - mIs15Bit( FALSE ), + mIs15Bit( false ), mAttributeBits(0), mColorMapDepth(0), @@ -94,7 +94,7 @@ LLImageTGA::LLImageTGA(const std::string& file_name) mColorMapStart( 0 ), mColorMapLength( 0 ), mColorMapBytesPerEntry( 0 ), - mIs15Bit( FALSE ) + mIs15Bit( false ) { loadFile(file_name); } @@ -104,7 +104,7 @@ LLImageTGA::~LLImageTGA() delete [] mColorMap; } -BOOL LLImageTGA::updateData() +bool LLImageTGA::updateData() { resetLastError(); @@ -112,7 +112,7 @@ BOOL LLImageTGA::updateData() if (!getData() || (0 == getDataSize())) { setLastError("LLImageTGA uninitialized"); - return FALSE; + return false; } // Pull image information from the header... @@ -185,13 +185,13 @@ BOOL LLImageTGA::updateData() case 0: // No image data included in file setLastError("Unable to load file. TGA file contains no image data."); - return FALSE; + return false; case 1: // Colormapped uncompressed if( 8 != mPixelSize ) { setLastError("Unable to load file. Colormapped images must have 8 bits per pixel."); - return FALSE; + return false; } break; case 2: @@ -202,7 +202,7 @@ BOOL LLImageTGA::updateData() if( 8 != mPixelSize ) { setLastError("Unable to load file. Monochrome images must have 8 bits per pixel."); - return FALSE; + return false; } break; case 9: @@ -216,12 +216,12 @@ BOOL LLImageTGA::updateData() if( 8 != mPixelSize ) { setLastError("Unable to load file. Monochrome images must have 8 bits per pixel."); - return FALSE; + return false; } break; default: setLastError("Unable to load file. Unrecoginzed TGA image type."); - return FALSE; + return false; } // discard the ID field, if any @@ -266,8 +266,8 @@ BOOL LLImageTGA::updateData() mColorMap = new U8[ color_map_bytes ]; if (!mColorMap) { - LL_ERRS() << "Out of Memory in BOOL LLImageTGA::updateData()" << LL_ENDL; - return FALSE; + LL_ERRS() << "Out of Memory in bool LLImageTGA::updateData()" << LL_ENDL; + return false; } memcpy( mColorMap, getData() + mDataOffset, color_map_bytes ); /* Flawfinder: ignore */ } @@ -302,28 +302,28 @@ BOOL LLImageTGA::updateData() // if( mAttributeBits != 8 ) // { // setLastError("Unable to load file. 32 bit TGA image does not have 8 bits of alpha."); -// return FALSE; +// return false; // } mAttributeBits = 8; break; case 15: case 16: components = 3; - mIs15Bit = TRUE; // 16th bit is used for Targa hardware interupts and is ignored. + mIs15Bit = true; // 16th bit is used for Targa hardware interupts and is ignored. break; case 8: components = 1; break; default: setLastError("Unable to load file. Unknown pixel size."); - return FALSE; + return false; } setSize(width, height, components); - return TRUE; + return true; } -BOOL LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) +bool LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) { llassert_always(raw_image); @@ -331,7 +331,7 @@ BOOL LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) if (!getData() || (0 == getDataSize())) { setLastError("LLImageTGA trying to decode an image with no data!"); - return FALSE; + return false; } // Copy everything after the header. @@ -343,18 +343,18 @@ BOOL LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) (getComponents() != 4) ) { setLastError("TGA images with a number of components other than 1, 3, and 4 are not supported."); - return FALSE; + return false; } if( mOriginRightBit ) { setLastError("TGA images with origin on right side are not supported."); - return FALSE; + return false; } - BOOL flipped = (mOriginTopBit != 0); - BOOL rle_compressed = ((mImageType & 0x08) != 0); + bool flipped = (mOriginTopBit != 0); + bool rle_compressed = ((mImageType & 0x08) != 0); if( mColorMap ) { @@ -366,10 +366,10 @@ BOOL LLImageTGA::decode(LLImageRaw* raw_image, F32 decode_time) } } -BOOL LLImageTGA::decodeTruecolor( LLImageRaw* raw_image, BOOL rle, BOOL flipped ) +bool LLImageTGA::decodeTruecolor( LLImageRaw* raw_image, bool rle, bool flipped ) { - BOOL success = FALSE; - BOOL alpha_opaque = FALSE; + bool success = false; + bool alpha_opaque = false; if( rle ) { @@ -404,7 +404,7 @@ BOOL LLImageTGA::decodeTruecolor( LLImageRaw* raw_image, BOOL rle, BOOL flipped } else { - BOOL alpha_opaque; + bool alpha_opaque; success = decodeTruecolorNonRle( raw_image, alpha_opaque ); if (alpha_opaque && raw_image->getComponents() == 4) { @@ -430,9 +430,9 @@ BOOL LLImageTGA::decodeTruecolor( LLImageRaw* raw_image, BOOL rle, BOOL flipped } -BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaque ) +bool LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, bool &alpha_opaque ) { - alpha_opaque = TRUE; + alpha_opaque = true; // Origin is the bottom left U8* dst = raw_image->getData(); @@ -442,7 +442,7 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu if (pixels * (mIs15Bit ? 2 : getComponents()) > getDataSize() - mDataOffset) { //here we have situation when data size in src less than actually needed - return FALSE; + return false; } if (getComponents() == 4) @@ -456,7 +456,7 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu dst[3] = src[3]; // Alpha if (dst[3] != 255) { - alpha_opaque = FALSE; + alpha_opaque = false; } dst += 4; src += 4; @@ -490,7 +490,7 @@ BOOL LLImageTGA::decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaqu memcpy(dst, src, pixels); /* Flawfinder: ignore */ } - return TRUE; + return true; } void LLImageTGA::decodeColorMapPixel8( U8* dst, const U8* src ) @@ -523,14 +523,14 @@ void LLImageTGA::decodeColorMapPixel32( U8* dst, const U8* src ) } -BOOL LLImageTGA::decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped ) +bool LLImageTGA::decodeColorMap( LLImageRaw* raw_image, bool rle, bool flipped ) { // If flipped, origin is the top left. Need to reverse the order of the rows. // Otherwise the origin is the bottom left. if( 8 != mPixelSize ) { - return FALSE; + return false; } U8* src = getData() + mDataOffset; @@ -544,7 +544,7 @@ BOOL LLImageTGA::decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped ) case 2: pixel_decoder = &LLImageTGA::decodeColorMapPixel15; break; case 3: pixel_decoder = &LLImageTGA::decodeColorMapPixel24; break; case 4: pixel_decoder = &LLImageTGA::decodeColorMapPixel32; break; - default: llassert(0); return FALSE; + default: llassert(0); return false; } if( rle ) @@ -613,12 +613,12 @@ BOOL LLImageTGA::decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped ) } } - return TRUE; + return true; } -BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) +bool LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) { llassert_always(raw_image); @@ -642,7 +642,7 @@ BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) mImageType = 2; break; default: - return FALSE; + return false; } // Color map stuff (unsupported) @@ -678,7 +678,7 @@ BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) bytes_per_pixel = 4; break; default: - return FALSE; + return false; } mPixelSize = U8(bytes_per_pixel * 8); // 8, 16, 24, 32 bits per pixel @@ -765,13 +765,13 @@ BOOL LLImageTGA::encode(const LLImageRaw* raw_image, F32 encode_time) break; } - return TRUE; + return true; } -BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque ) +bool LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, bool &alpha_opaque ) { llassert( getComponents() == 4 ); - alpha_opaque = TRUE; + alpha_opaque = true; U8* dst = raw_image->getData(); U32* dst_pixels = (U32*) dst; @@ -788,7 +788,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque // Read RLE block header if (src >= last_src) - return FALSE; + return false; U8 block_header_byte = *src; src++; @@ -799,7 +799,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque // Encoded (duplicate-pixel) block if (src + 3 >= last_src) - return FALSE; + return false; rgba_byte_p[0] = src[2]; rgba_byte_p[1] = src[1]; @@ -807,7 +807,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque rgba_byte_p[3] = src[3]; if (rgba_byte_p[3] != 255) { - alpha_opaque = FALSE; + alpha_opaque = false; } src += 4; @@ -826,7 +826,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque do { if (src + 3 >= last_src) - return FALSE; + return false; ((U8*)dst_pixels)[0] = src[2]; ((U8*)dst_pixels)[1] = src[1]; @@ -834,7 +834,7 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque ((U8*)dst_pixels)[3] = src[3]; if (src[3] != 255) { - alpha_opaque = FALSE; + alpha_opaque = false; } src += 4; dst_pixels++; @@ -844,10 +844,10 @@ BOOL LLImageTGA::decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque } } - return TRUE; + return true; } -BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) +bool LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) { llassert( getComponents() == 3 ); llassert( mIs15Bit ); @@ -863,7 +863,7 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) // Read RLE block header if (src >= last_src) - return FALSE; + return false; U8 block_header_byte = *src; src++; @@ -875,7 +875,7 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) do { if (src + 2 >= last_src) - return FALSE; + return false; decodeTruecolorPixel15( dst, src ); // slow dst += 3; @@ -890,7 +890,7 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) do { if (src + 2 >= last_src) - return FALSE; + return false; decodeTruecolorPixel15( dst, src ); dst += 3; @@ -901,12 +901,12 @@ BOOL LLImageTGA::decodeTruecolorRle15( LLImageRaw* raw_image ) } } - return TRUE; + return true; } -BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) +bool LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) { llassert( getComponents() == 3 ); @@ -921,7 +921,7 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) // Read RLE block header if (src >= last_src) - return FALSE; + return false; U8 block_header_byte = *src; src++; @@ -933,7 +933,7 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) do { if (src + 2 >= last_src) - return FALSE; + return false; dst[0] = src[2]; dst[1] = src[1]; dst[2] = src[0]; @@ -949,7 +949,7 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) do { if (src + 2 >= last_src) - return FALSE; + return false; dst[0] = src[2]; dst[1] = src[1]; @@ -962,11 +962,11 @@ BOOL LLImageTGA::decodeTruecolorRle24( LLImageRaw* raw_image ) } } - return TRUE; + return true; } -BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) +bool LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) { llassert( getComponents() == 1 ); @@ -981,7 +981,7 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) // Read RLE block header if (src >= last_src) - return FALSE; + return false; U8 block_header_byte = *src; src++; @@ -990,7 +990,7 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) if( block_header_byte & 0x80 ) { if (src >= last_src) - return FALSE; + return false; // Encoded (duplicate-pixel) block memset( dst, *src, block_pixel_count ); @@ -1003,7 +1003,7 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) do { if (src >= last_src) - return FALSE; + return false; *dst = *src; dst++; @@ -1014,13 +1014,13 @@ BOOL LLImageTGA::decodeTruecolorRle8( LLImageRaw* raw_image ) } } - return TRUE; + return true; } // Decoded and process the image for use in avatar gradient masks. // Processing happens during the decode for speed. -BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight ) +bool LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight ) { llassert_always(raw_image); @@ -1043,14 +1043,14 @@ BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight if (!getData() || (0 == getDataSize())) { setLastError("LLImageTGA trying to decode an image with no data!"); - return FALSE; + return false; } // Only works for unflipped monochrome RLE images if( (getComponents() != 1) || (mImageType != 11) || mOriginTopBit || mOriginRightBit ) { LL_ERRS() << "LLImageTGA trying to alpha-gradient process an image that's not a standard RLE, one component image" << LL_ENDL; - return FALSE; + return false; } raw_image->resize(getWidth(), getHeight(), getComponents()); @@ -1136,7 +1136,7 @@ BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight } } } - return TRUE; + return true; } // Reads a .tga file and creates an LLImageTGA with its data. diff --git a/indra/llimage/llimagetga.h b/indra/llimage/llimagetga.h index 5da3525149..b1f34dcdad 100644 --- a/indra/llimage/llimagetga.h +++ b/indra/llimage/llimagetga.h @@ -41,25 +41,25 @@ public: LLImageTGA(const std::string& file_name); /*virtual*/ std::string getExtension() { return std::string("tga"); } - /*virtual*/ BOOL updateData(); - /*virtual*/ BOOL decode(LLImageRaw* raw_image, F32 decode_time=0.0); - /*virtual*/ BOOL encode(const LLImageRaw* raw_image, F32 encode_time=0.0); + /*virtual*/ bool updateData(); + /*virtual*/ bool decode(LLImageRaw* raw_image, F32 decode_time=0.0); + /*virtual*/ bool encode(const LLImageRaw* raw_image, F32 encode_time=0.0); - BOOL decodeAndProcess(LLImageRaw* raw_image, F32 domain, F32 weight); + bool decodeAndProcess(LLImageRaw* raw_image, F32 domain, F32 weight); private: - BOOL decodeTruecolor( LLImageRaw* raw_image, BOOL rle, BOOL flipped ); + bool decodeTruecolor( LLImageRaw* raw_image, bool rle, bool flipped ); - BOOL decodeTruecolorRle8( LLImageRaw* raw_image ); - BOOL decodeTruecolorRle15( LLImageRaw* raw_image ); - BOOL decodeTruecolorRle24( LLImageRaw* raw_image ); - BOOL decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque ); + bool decodeTruecolorRle8( LLImageRaw* raw_image ); + bool decodeTruecolorRle15( LLImageRaw* raw_image ); + bool decodeTruecolorRle24( LLImageRaw* raw_image ); + bool decodeTruecolorRle32( LLImageRaw* raw_image, bool &alpha_opaque ); void decodeTruecolorPixel15( U8* dst, const U8* src ); - BOOL decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaque ); + bool decodeTruecolorNonRle( LLImageRaw* raw_image, bool &alpha_opaque ); - BOOL decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped ); + bool decodeColorMap( LLImageRaw* raw_image, bool rle, bool flipped ); void decodeColorMapPixel8(U8* dst, const U8* src); void decodeColorMapPixel15(U8* dst, const U8* src); @@ -100,7 +100,7 @@ private: S32 mColorMapLength; S32 mColorMapBytesPerEntry; - BOOL mIs15Bit; + bool mIs15Bit; static const U8 s5to8bits[32]; }; diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index 0152b879c2..3bb1778d9d 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -100,19 +100,19 @@ LLImageJ2COJ::~LLImageJ2COJ() { } -BOOL LLImageJ2COJ::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) +bool LLImageJ2COJ::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) { // No specific implementation for this method in the OpenJpeg case - return FALSE; + return false; } -BOOL LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) +bool LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) { // No specific implementation for this method in the OpenJpeg case - return FALSE; + return false; } -BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) +bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { // // FIXME: Get the comment field out of the texture @@ -179,7 +179,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod opj_image_destroy(image); } - return TRUE; // done + return true; // done } // sometimes we get bad data out of the cache - check to see if the decode succeeded @@ -189,8 +189,8 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod { // if we didn't get the discard level we're expecting, fail opj_image_destroy(image); - base.mDecoding = FALSE; - return TRUE; + base.mDecoding = false; + return true; } } @@ -202,7 +202,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod opj_image_destroy(image); } - return TRUE; + return true; } // Copy image data into our raw image format (instead of the separate channel format @@ -249,18 +249,18 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod LL_DEBUGS("Texture") << "ERROR -> decodeImpl: failed to decode image! (NULL comp data - OpenJPEG bug)" << LL_ENDL; opj_image_destroy(image); - return TRUE; // done + return true; // done } } /* free image data structure */ opj_image_destroy(image); - return TRUE; // done + return true; // done } -BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, BOOL reversible) +bool LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, bool reversible) { const S32 MAX_COMPS = 5; opj_cparameters_t parameters; /* compression parameters */ @@ -381,7 +381,7 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con { opj_cio_close(cio); LL_DEBUGS("Texture") << "Failed to encode image." << LL_ENDL; - return FALSE; + return false; } codestream_length = cio_tell(cio); @@ -400,10 +400,10 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con /* free image data */ opj_image_destroy(image); - return TRUE; + return true; } -BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) +bool LLImageJ2COJ::getMetadata(LLImageJ2C &base) { // // FIXME: We get metadata by decoding the ENTIRE image. @@ -466,7 +466,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) if(!image) { LL_WARNS() << "ERROR -> getMetadata: failed to decode image!" << LL_ENDL; - return FALSE; + return false; } // Copy image data into our raw image format (instead of the separate channel format @@ -480,5 +480,5 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) /* free image data structure */ opj_image_destroy(image); - return TRUE; + return true; } diff --git a/indra/llimagej2coj/llimagej2coj.h b/indra/llimagej2coj/llimagej2coj.h index ae96a175a2..5c6193944e 100644 --- a/indra/llimagej2coj/llimagej2coj.h +++ b/indra/llimagej2coj/llimagej2coj.h @@ -35,12 +35,12 @@ public: LLImageJ2COJ(); virtual ~LLImageJ2COJ(); protected: - virtual BOOL getMetadata(LLImageJ2C &base); - virtual BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); - virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, - BOOL reversible = FALSE); - virtual BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); - virtual BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); + virtual bool getMetadata(LLImageJ2C &base); + virtual bool decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); + virtual bool encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, + bool reversible = false); + virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); + virtual bool initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); virtual std::string getEngineInfo() const; }; diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index 44dc9daabd..0b2ac03b9d 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -88,11 +88,11 @@ class LLKDUDecodeState public: LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap); ~LLKDUDecodeState(); - BOOL processTileDecode(F32 decode_time, BOOL limit_time = TRUE); + bool processTileDecode(F32 decode_time, bool limit_time = true); private: S32 mNumComponents; - BOOL mUseYCC; + bool mUseYCC; kdu_dims mDims; kdu_sample_allocator mAllocator; kdu_tile_comp mComps[4]; @@ -190,7 +190,7 @@ LLImageJ2CKDU::~LLImageJ2CKDU() // Stuff for new simple decode void transfer_bytes(kdu_byte *dest, kdu_line_buf &src, int gap, int precision); -void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECodeStreamMode mode) +void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECodeStreamMode mode) { S32 data_size = base.getDataSize(); S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size); @@ -316,12 +316,12 @@ void LLImageJ2CKDU::cleanupCodeStream() mTileIndicesp = NULL; } -BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) +bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level, int* region) { return initDecode(base,raw_image,0.0f,MODE_FAST,0,4,discard_level,region); } -BOOL LLImageJ2CKDU::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) +bool LLImageJ2CKDU::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size, int precincts_size, int levels) { mPrecinctsSize = precincts_size; if (mPrecinctsSize != -1) @@ -345,10 +345,10 @@ BOOL LLImageJ2CKDU::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int bloc mLevels = llclamp(mLevels,MIN_DECOMPOSITION_LEVELS,MAX_DECOMPOSITION_LEVELS); base.setLevels(mLevels); } - return TRUE; + return true; } -BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level, int* region) +bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level, int* region) { base.resetLastError(); @@ -360,7 +360,7 @@ BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco //findDiscardLevelsBoundaries(base); base.updateRawDiscardLevel(); - setupCodeStream(base, TRUE, mode); + setupCodeStream(base, true, mode); mRawImagep = &raw_image; mCodeStreamp->change_appearance(false, true, false); @@ -408,20 +408,20 @@ BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco catch (const char* msg) { base.setLastError(ll_safe_string(msg)); - return FALSE; + return false; } catch (...) { base.setLastError("Unknown J2C error"); - return FALSE; + return false; } - return TRUE; + return true; } -// Returns TRUE to mean done, whether successful or not. -BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) +// Returns true to mean done, whether successful or not. +bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { ECodeStreamMode mode = MODE_FAST; @@ -433,7 +433,7 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco { // Initializing the J2C decode failed, bail out. cleanupCodeStream(); - return TRUE; // done + return true; // done } } @@ -492,7 +492,7 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco { // Not finished decoding yet. // setLastError("Ran out of time while decoding"); - return FALSE; + return false; } } catch (const char* msg) @@ -500,14 +500,14 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco base.setLastError(ll_safe_string(msg)); base.decodeFailed(); cleanupCodeStream(); - return TRUE; // done + return true; // done } catch (...) { base.setLastError( "Unknown J2C error" ); base.decodeFailed(); cleanupCodeStream(); - return TRUE; // done + return true; // done } @@ -519,11 +519,11 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco cleanupCodeStream(); - return TRUE; + return true; } -BOOL LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, BOOL reversible) +bool LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, bool reversible) { // Declare and set simple arguments bool transpose = false; @@ -691,36 +691,36 @@ BOOL LLImageJ2CKDU::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, co catch(const char* msg) { base.setLastError(ll_safe_string(msg)); - return FALSE; + return false; } catch( ... ) { base.setLastError( "Unknown J2C error" ); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL LLImageJ2CKDU::getMetadata(LLImageJ2C &base) +bool LLImageJ2CKDU::getMetadata(LLImageJ2C &base) { // *FIX: kdu calls our callback function if there's an error, and // then bombs. To regain control, we throw an exception, and // catch it here. try { - setupCodeStream(base, FALSE, MODE_FAST); - return TRUE; + setupCodeStream(base, false, MODE_FAST); + return true; } catch (const char* msg) { base.setLastError(ll_safe_string(msg)); - return FALSE; + return false; } catch (...) { base.setLastError( "Unknown J2C error" ); - return FALSE; + return false; } } @@ -830,7 +830,7 @@ void LLImageJ2CKDU::findDiscardLevelsBoundaries(LLImageJ2C &base) { //std::cout << "Parsing discard level = " << discard_level << std::endl; // Create the input codestream object. - setupCodeStream(base, TRUE, MODE_FAST); + setupCodeStream(base, true, MODE_FAST); mCodeStreamp->apply_input_restrictions(0, 4, discard_level, 0, NULL); mCodeStreamp->set_max_bytes(KDU_LONG_MAX,true); siz_params *siz_in = mCodeStreamp->access_siz(); @@ -1189,7 +1189,7 @@ LLKDUDecodeState::~LLKDUDecodeState() mTile.close(); } -BOOL LLKDUDecodeState::processTileDecode(F32 decode_time, BOOL limit_time) +bool LLKDUDecodeState::processTileDecode(F32 decode_time, bool limit_time) /* Decompresses a tile, writing the data into the supplied byte buffer. The buffer contains interleaved image components, if there are any. Although you may think of the buffer as belonging entirely to this tile, @@ -1221,11 +1221,11 @@ separation between consecutive rows in the real buffer. */ { if (limit_time && decode_timer.getElapsedTimeF32() > decode_time) { - return FALSE; + return false; } } } - return TRUE; + return true; } // kdc_flow_control diff --git a/indra/llkdu/llimagej2ckdu.h b/indra/llkdu/llimagej2ckdu.h index 85dc408d4d..da84749796 100644 --- a/indra/llkdu/llimagej2ckdu.h +++ b/indra/llkdu/llimagej2ckdu.h @@ -65,18 +65,18 @@ public: virtual ~LLImageJ2CKDU(); protected: - virtual BOOL getMetadata(LLImageJ2C &base); - virtual BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); - virtual BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, - BOOL reversible=FALSE); - virtual BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); - virtual BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); + virtual bool getMetadata(LLImageJ2C &base); + virtual bool decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count); + virtual bool encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0, + bool reversible=false); + virtual bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL); + virtual bool initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0); virtual std::string getEngineInfo() const; void findDiscardLevelsBoundaries(LLImageJ2C &base); private: - BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level = -1, int* region = NULL); - void setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECodeStreamMode mode); + bool initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level = -1, int* region = NULL); + void setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECodeStreamMode mode); void cleanupCodeStream(); // Encode variable diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp index 0605fad068..e8b550baa6 100644 --- a/indra/llkdu/tests/llimagej2ckdu_test.cpp +++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp @@ -60,7 +60,7 @@ LLImageRaw::~LLImageRaw() { } U8* LLImageRaw::allocateData(S32 ) { return NULL; } void LLImageRaw::deleteData() { } U8* LLImageRaw::reallocateData(S32 ) { return NULL; } -BOOL LLImageRaw::resize(U16, U16, S8) { return TRUE; } // this method always returns TRUE... +bool LLImageRaw::resize(U16, U16, S8) { return true; } // this method always returns true... LLImageBase::LLImageBase() : LLTrace::MemTrackable<LLImageBase>("LLImageBase"), @@ -89,8 +89,8 @@ LLImageFormatted::~LLImageFormatted() { } U8* LLImageFormatted::allocateData(S32 ) { return NULL; } S32 LLImageFormatted::calcDataSize(S32 ) { return 0; } S32 LLImageFormatted::calcDiscardLevelBytes(S32 ) { return 0; } -BOOL LLImageFormatted::decodeChannels(LLImageRaw*, F32, S32, S32) { return FALSE; } -BOOL LLImageFormatted::copyData(U8 *, S32) { return TRUE; } // this method always returns TRUE... +bool LLImageFormatted::decodeChannels(LLImageRaw*, F32, S32, S32) { return false; } +bool LLImageFormatted::copyData(U8 *, S32) { return true; } // this method always returns true... void LLImageFormatted::deleteData() { } void LLImageFormatted::dump() { } U8* LLImageFormatted::reallocateData(S32 ) { return NULL; } @@ -103,14 +103,14 @@ LLImageJ2C::~LLImageJ2C() { } S32 LLImageJ2C::calcDataSize(S32 ) { return 0; } S32 LLImageJ2C::calcDiscardLevelBytes(S32 ) { return 0; } S32 LLImageJ2C::calcHeaderSize() { return 0; } -BOOL LLImageJ2C::decode(LLImageRaw*, F32) { return FALSE; } -BOOL LLImageJ2C::decodeChannels(LLImageRaw*, F32, S32, S32 ) { return FALSE; } +bool LLImageJ2C::decode(LLImageRaw*, F32) { return false; } +bool LLImageJ2C::decodeChannels(LLImageRaw*, F32, S32, S32 ) { return false; } void LLImageJ2C::decodeFailed() { } -BOOL LLImageJ2C::encode(const LLImageRaw*, F32) { return FALSE; } +bool LLImageJ2C::encode(const LLImageRaw*, F32) { return false; } S8 LLImageJ2C::getRawDiscardLevel() { return 0; } void LLImageJ2C::resetLastError() { } void LLImageJ2C::setLastError(const std::string&, const std::string&) { } -BOOL LLImageJ2C::updateData() { return FALSE; } +bool LLImageJ2C::updateData() { return false; } void LLImageJ2C::updateRawDiscardLevel() { } LLKDUMemIn::LLKDUMemIn(const U8*, const U32, const U16, const U16, const U8, siz_params*) { } @@ -212,12 +212,12 @@ namespace tut { public: // Provides public access to some protected methods for testing - BOOL callGetMetadata(LLImageJ2C &base) { return getMetadata(base); } - BOOL callDecodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) + bool callGetMetadata(LLImageJ2C &base) { return getMetadata(base); } + bool callDecodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count) { return decodeImpl(base, raw_image, decode_time, first_channel, max_channel_count); } - BOOL callEncodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text) + bool callEncodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text) { return encodeImpl(base, raw_image, comment_text); } @@ -254,10 +254,10 @@ namespace tut void llimagej2ckdu_object_t::test<1>() { LLImageJ2C* image = new LLImageJ2C(); - BOOL res = mImage->callGetMetadata(*image); - // Trying to set up a data stream with all NIL values and stubbed KDU will "work" and return TRUE - // Note that is linking with KDU, that call will throw an exception and fail, returning FALSE - ensure("getMetadata() test failed", res == TRUE); + bool res = mImage->callGetMetadata(*image); + // Trying to set up a data stream with all NIL values and stubbed KDU will "work" and return true + // Note that is linking with KDU, that call will throw an exception and fail, returning false + ensure("getMetadata() test failed", res); } // Test 2 : test decodeImpl() @@ -266,9 +266,9 @@ namespace tut { LLImageJ2C* image = new LLImageJ2C(); LLImageRaw* raw = new LLImageRaw(); - BOOL res = mImage->callDecodeImpl(*image, *raw, 0.0, 0, 0); - // Decoding returns TRUE whenever there's nothing else to do, including if decoding failed, so we'll get TRUE here - ensure("decodeImpl() test failed", res == TRUE); + bool res = mImage->callDecodeImpl(*image, *raw, 0.0, 0, 0); + // Decoding returns true whenever there's nothing else to do, including if decoding failed, so we'll get true here + ensure("decodeImpl() test failed", res); } // Test 3 : test encodeImpl() @@ -277,8 +277,8 @@ namespace tut { LLImageJ2C* image = new LLImageJ2C(); LLImageRaw* raw = new LLImageRaw(); - BOOL res = mImage->callEncodeImpl(*image, *raw, NULL); - // Encoding returns TRUE unless an exception was raised, so we'll get TRUE here though nothing really was done - ensure("encodeImpl() test failed", res == TRUE); + bool res = mImage->callEncodeImpl(*image, *raw, NULL); + // Encoding returns true unless an exception was raised, so we'll get true here though nothing really was done + ensure("encodeImpl() test failed", res); } } |