diff options
Diffstat (limited to 'src/kernel/tqimage.cpp')
| -rw-r--r-- | src/kernel/tqimage.cpp | 249 |
1 files changed, 124 insertions, 125 deletions
diff --git a/src/kernel/tqimage.cpp b/src/kernel/tqimage.cpp index 177c0a6af..35dabb6e7 100644 --- a/src/kernel/tqimage.cpp +++ b/src/kernel/tqimage.cpp @@ -486,12 +486,12 @@ TQImage::TQImage( uchar* yourdata, int w, int h, int depth, data->nbytes = bpl*h; if ( colortable || !data->ncols ) { data->ctbl = colortable; - data->ctbl_mine = FALSE; + data->ctbl_mine = false; } else { // calloc since we realloc, etc. later (ick) data->ctbl = (TQRgb*)calloc( data->ncols*sizeof(TQRgb), data->ncols ); TQ_CHECK_PTR(data->ctbl); - data->ctbl_mine = TRUE; + data->ctbl_mine = true; } uchar** jt = (uchar**)malloc(h*sizeof(uchar*)); TQ_CHECK_PTR(jt); @@ -667,14 +667,14 @@ TQImage TQImage::copy(int x, int y, int w, int h, int conversion_flags) const // alpha channel should be only copied, not used by bitBlt(), and // this is mutable, we will restore the image state before returning TQImage *that = (TQImage *) this; - that->setAlphaBuffer( FALSE ); + that->setAlphaBuffer( false ); } memcpy( image.colorTable(), colorTable(), numColors()*sizeof(TQRgb) ); bitBlt( &image, dx, dy, this, x, y, -1, -1, conversion_flags ); if ( has_alpha ) { // restore image state TQImage *that = (TQImage *) this; - that->setAlphaBuffer( TRUE ); + that->setAlphaBuffer( true ); } image.setAlphaBuffer(hasAlphaBuffer()); image.data->dpmx = dotsPerMeterX(); @@ -702,7 +702,7 @@ TQImage TQImage::copy(int x, int y, int w, int h, int conversion_flags) const /*! \fn bool TQImage::isNull() const - Returns TRUE if it is a null image; otherwise returns FALSE. + Returns true if it is a null image; otherwise returns false. A null image has all parameters set to zero and no allocated data. */ @@ -977,7 +977,7 @@ void TQImage::fill( uint pixel ) /*! Inverts all pixel values in the image. - If the depth is 32: if \a invertAlpha is TRUE, the alpha bits are + If the depth is 32: if \a invertAlpha is true, the alpha bits are also inverted, otherwise they are left unchanged. If the depth is not 32, the argument \a invertAlpha has no @@ -1085,7 +1085,7 @@ void TQImage::setNumColors( int numColors ) if ( data->ctbl_mine ) free( data->ctbl ); else - data->ctbl_mine = TRUE; + data->ctbl_mine = true; data->ctbl = 0; } data->ncols = 0; @@ -1099,7 +1099,7 @@ void TQImage::setNumColors( int numColors ) } else { // create new color table data->ctbl = (TQRgb*)calloc( numColors*sizeof(TQRgb), 1 ); TQ_CHECK_PTR(data->ctbl); - data->ctbl_mine = TRUE; + data->ctbl_mine = true; } data->ncols = data->ctbl == 0 ? 0 : numColors; } @@ -1108,14 +1108,14 @@ void TQImage::setNumColors( int numColors ) /*! \fn bool TQImage::hasAlphaBuffer() const - Returns TRUE if alpha buffer mode is enabled; otherwise returns - FALSE. + Returns true if alpha buffer mode is enabled; otherwise returns + false. \sa setAlphaBuffer() */ /*! - Enables alpha buffer mode if \a enable is TRUE, otherwise disables + Enables alpha buffer mode if \a enable is true, otherwise disables it. The default setting is disabled. An 8-bpp image has 8-bit pixels. A pixel is an index into the @@ -1144,8 +1144,8 @@ void TQImage::setAlphaBuffer( bool enable ) /*! Sets the image \a width, \a height, \a depth, its number of colors - (in \a numColors), and bit order. Returns TRUE if successful, or - FALSE if the parameters are incorrect or if memory cannot be + (in \a numColors), and bit order. Returns true if successful, or + false if the parameters are incorrect or if memory cannot be allocated. The \a width and \a height is limited to 32767. \a depth must be @@ -1169,12 +1169,12 @@ bool TQImage::create( int width, int height, int depth, int numColors, { reset(); // reset old data if ( width <= 0 || height <= 0 || depth <= 0 || numColors < 0 ) - return FALSE; // invalid parameter(s) + return false; // invalid parameter(s) if ( depth == 1 && bitOrder == IgnoreEndian ) { #if defined(QT_CHECK_RANGE) tqWarning( "TQImage::create: Bit order is required for 1 bpp images" ); #endif - return FALSE; + return false; } if ( depth != 1 ) bitOrder = IgnoreEndian; @@ -1195,18 +1195,18 @@ bool TQImage::create( int width, int height, int depth, int numColors, #endif break; default: // invalid depth - return FALSE; + return false; } if ( depth == 32 ) numColors = 0; setNumColors( numColors ); if ( data->ncols != numColors ) // could not alloc color table - return FALSE; + return false; if ( INT_MAX / uint(depth) < uint(width) ) { // sanity check for potential overflow setNumColors( 0 ); - return FALSE; + return false; } const int bpl = ((width*depth+31)/32)*4; // bytes per scanline // #### WWA: shouldn't this be (width*depth+7)/8: @@ -1215,7 +1215,7 @@ bool TQImage::create( int width, int height, int depth, int numColors, || bpl < 0 || INT_MAX / sizeof(uchar *) < uint(height) ) { // sanity check for potential overflow setNumColors( 0 ); - return FALSE; + return false; } int nbytes = bpl*height; // image size int ptbl = height*sizeof(uchar*); // pointer table size @@ -1224,7 +1224,7 @@ bool TQImage::create( int width, int height, int depth, int numColors, TQ_CHECK_PTR(p); if ( !p ) { // no memory setNumColors( 0 ); - return FALSE; + return false; } data->w = width; data->h = height; @@ -1240,7 +1240,7 @@ bool TQImage::create( int width, int height, int depth, int numColors, memset( d+bpl-pad, 0, pad ); d += bpl; } - return TRUE; + return true; } /*! @@ -1271,7 +1271,7 @@ void TQImage::reinit() data->ctbl = 0; data->bits = 0; data->bitordr = TQImage::IgnoreEndian; - data->alpha = FALSE; + data->alpha = false; #ifndef TQT_NO_IMAGE_TEXT data->misc = 0; #endif @@ -1318,18 +1318,18 @@ static bool convert_32_to_8( const TQImage *src, TQImage *dst, int conversion_fl { TQRgb *p; uchar *b; - bool do_quant = FALSE; + bool do_quant = false; int y, x; if ( !dst->create(src->width(), src->height(), 8, 256) ) - return FALSE; + return false; const int tablesize = 997; // prime TQRgbMap table[tablesize]; int pix=0; TQRgb amask = src->hasAlphaBuffer() ? 0xffffffff : 0x00ffffff; if ( src->hasAlphaBuffer() ) - dst->setAlphaBuffer(TRUE); + dst->setAlphaBuffer(true); if ( palette ) { // Preload palette into table. @@ -1363,7 +1363,7 @@ static bool convert_32_to_8( const TQImage *src, TQImage *dst, int conversion_fl } if ( (conversion_flags & TQt::DitherMode_Mask) == TQt::PreferDither ) { - do_quant = TRUE; + do_quant = true; } else { for ( y=0; y<src->height(); y++ ) { // check if <= 256 colors p = (TQRgb *)src->scanLine(y); @@ -1384,7 +1384,7 @@ static bool convert_32_to_8( const TQImage *src, TQImage *dst, int conversion_fl } else { // Cannot be in table if ( pix == 256 ) { // too many colors - do_quant = TRUE; + do_quant = true; // Break right out x = 0; y = src->height(); @@ -1616,14 +1616,14 @@ static bool convert_32_to_8( const TQImage *src, TQImage *dst, int conversion_fl } - return TRUE; + return true; } static bool convert_8_to_32( const TQImage *src, TQImage *dst ) { if ( !dst->create(src->width(), src->height(), 32) ) - return FALSE; // create failed + return false; // create failed dst->setAlphaBuffer( src->hasAlphaBuffer() ); for ( int y=0; y<dst->height(); y++ ) { // for each scan line... uint *p = (uint *)dst->scanLine(y); @@ -1632,14 +1632,14 @@ static bool convert_8_to_32( const TQImage *src, TQImage *dst ) while ( p < end ) *p++ = src->color(*b++); } - return TRUE; + return true; } static bool convert_1_to_32( const TQImage *src, TQImage *dst ) { if ( !dst->create(src->width(), src->height(), 32) ) - return FALSE; // could not create + return false; // could not create dst->setAlphaBuffer( src->hasAlphaBuffer() ); for ( int y=0; y<dst->height(); y++ ) { // for each scan line... uint *p = (uint *)dst->scanLine(y); @@ -1659,14 +1659,14 @@ static bool convert_1_to_32( const TQImage *src, TQImage *dst ) } } } - return TRUE; + return true; } #endif // TQT_NO_IMAGE_TRUECOLOR static bool convert_1_to_8( const TQImage *src, TQImage *dst ) { if ( !dst->create(src->width(), src->height(), 8, 2) ) - return FALSE; // something failed + return false; // something failed dst->setAlphaBuffer( src->hasAlphaBuffer() ); if (src->numColors() >= 2) { dst->setColor( 0, src->color(0) ); // copy color table @@ -1697,7 +1697,7 @@ static bool convert_1_to_8( const TQImage *src, TQImage *dst ) } } } - return TRUE; + return true; } #ifndef TQT_NO_IMAGE_DITHER_TO_1 @@ -1709,7 +1709,7 @@ static bool dither_to_1( const TQImage *src, TQImage *dst, int conversion_flags, bool fromalpha ) { if ( !dst->create(src->width(), src->height(), 1, 2, TQImage::BigEndian) ) - return FALSE; // something failed + return false; // something failed enum { Threshold, Ordered, Diffuse } dithermode; @@ -1756,7 +1756,7 @@ static bool dither_to_1( const TQImage *src, TQImage *dst, int *line2 = new int[w]; int bmwidth = (w+7)/8; if ( !(line1 && line2) ) - return FALSE; + return false; uchar *p; uchar *end; int *b1, *b2; @@ -1986,7 +1986,7 @@ static bool dither_to_1( const TQImage *src, TQImage *dst, } } } - return TRUE; + return true; } #endif @@ -2004,7 +2004,7 @@ static inline bool is16BitGray( ushort c ) static bool convert_16_to_32( const TQImage *src, TQImage *dst ) { if ( !dst->create(src->width(), src->height(), 32) ) - return FALSE; // create failed + return false; // create failed dst->setAlphaBuffer( src->hasAlphaBuffer() ); for ( int y=0; y<dst->height(); y++ ) { // for each scan line... uint *p = (uint *)dst->scanLine(y); @@ -2013,14 +2013,14 @@ static bool convert_16_to_32( const TQImage *src, TQImage *dst ) while ( p < end ) *p++ = qt_conv16ToRgb( *s++ ); } - return TRUE; + return true; } static bool convert_32_to_16( const TQImage *src, TQImage *dst ) { if ( !dst->create(src->width(), src->height(), 16) ) - return FALSE; // create failed + return false; // create failed dst->setAlphaBuffer( src->hasAlphaBuffer() ); for ( int y=0; y<dst->height(); y++ ) { // for each scan line... ushort *p = (ushort *)dst->scanLine(y); @@ -2029,7 +2029,7 @@ static bool convert_32_to_16( const TQImage *src, TQImage *dst ) while ( p < end ) *p++ = qt_convRgbTo16( *s++ ); } - return TRUE; + return true; } @@ -2059,7 +2059,7 @@ TQImage TQImage::convertDepth( int depth, int conversion_flags ) const image = *this; // no conversion #ifndef TQT_NO_IMAGE_DITHER_TO_1 else if ( (data->d == 8 || data->d == 32) && depth == 1 ) // dither - dither_to_1( this, &image, conversion_flags, FALSE ); + dither_to_1( this, &image, conversion_flags, false ); #endif #ifndef TQT_NO_IMAGE_TRUECOLOR else if ( data->d == 32 && depth == 8 ) // 32 -> 8 @@ -2104,8 +2104,8 @@ TQImage TQImage::convertDepth( int depth ) const } /*! - Returns TRUE if ( \a x, \a y ) is a valid coordinate in the image; - otherwise returns FALSE. + Returns true if ( \a x, \a y ) is a valid coordinate in the image; + otherwise returns false. \sa width() height() pixelIndex() */ @@ -2306,9 +2306,9 @@ bool isGray(TQRgb c) } /*! - Returns TRUE if all the colors in the image are shades of gray + Returns true if all the colors in the image are shades of gray (i.e. their red, green and blue components are equal); otherwise - returns FALSE. + returns false. This function is slow for large 32-bit images. @@ -2322,33 +2322,33 @@ bool TQImage::allGray() const TQRgb* b = (TQRgb*)bits(); while (p--) if (!isGray(*b++)) - return FALSE; + return false; #ifndef TQT_NO_IMAGE_16_BIT } else if (depth()==16) { int p = width()*height(); ushort* b = (ushort*)bits(); while (p--) if (!is16BitGray(*b++)) - return FALSE; + return false; #endif } else #endif //TQT_NO_IMAGE_TRUECOLOR { - if (!data->ctbl) return TRUE; + if (!data->ctbl) return true; for (int i=0; i<numColors(); i++) if (!isGray(data->ctbl[i])) - return FALSE; + return false; } - return TRUE; + return true; } /*! For 32-bit images, this function is equivalent to allGray(). - For 8-bpp images, this function returns TRUE if color(i) is + For 8-bpp images, this function returns true if color(i) is TQRgb(i,i,i) for all indices of the color table; otherwise returns - FALSE. + false. \sa allGray() depth() */ @@ -2365,11 +2365,11 @@ bool TQImage::isGrayscale() const case 8: { for (int i=0; i<numColors(); i++) if (data->ctbl[i] != tqRgb(i,i,i)) - return FALSE; - return TRUE; + return false; + return true; } } - return FALSE; + return false; } #ifndef TQT_NO_IMAGE_SMOOTHSCALE @@ -2428,7 +2428,7 @@ void pnmscale(const TQImage& src, TQImage& dst) tempxelrow = new TQRgb[cols]; if ( src.hasAlphaBuffer() ) { - dst.setAlphaBuffer(TRUE); + dst.setAlphaBuffer(true); as = new long[cols]; for ( col = 0; col < cols; ++col ) as[col] = HALFSCALE; @@ -2982,7 +2982,6 @@ TQImage TQImage::xForm( const TQWMatrix &matrix ) const TQImage TQImage::createAlphaMask( int conversion_flags ) const { if ( conversion_flags == 1 ) { - // Old code is passing "TRUE". conversion_flags = TQt::DiffuseAlphaDither; } @@ -2997,7 +2996,7 @@ TQImage TQImage::createAlphaMask( int conversion_flags ) const } TQImage mask1; - dither_to_1( this, &mask1, conversion_flags, TRUE ); + dither_to_1( this, &mask1, conversion_flags, true ); return mask1; } #endif @@ -3015,7 +3014,7 @@ TQImage TQImage::createAlphaMask( int conversion_flags ) const The returned image has little-endian bit order, which you can convert to big-endianness using convertBitOrder(). - If \a clipTight is TRUE the mask is just large enough to cover the + If \a clipTight is true the mask is just large enough to cover the pixels; otherwise, the mask is larger than the data pixels. This function disregards the \link hasAlphaBuffer() alpha buffer @@ -3057,10 +3056,10 @@ TQImage TQImage::createHeuristicMask( bool clipTight ) const } int x,y; - bool done = FALSE; + bool done = false; uchar *ypp, *ypc, *ypn; while( !done ) { - done = TRUE; + done = true; ypn = m.scanLine(0); ypc = 0; for ( y = 0; y < h; y++ ) { @@ -3078,7 +3077,7 @@ TQImage TQImage::createHeuristicMask( bool clipTight ) const !(*(ypn + (x >> 3)) & (1 << (x & 7))) ) && ( (*(ypc + (x >> 3)) & (1 << (x & 7))) ) && ( (*p & 0x00ffffff) == background ) ) { - done = FALSE; + done = false; *(ypc + (x >> 3)) &= ~(1 << (x & 7)); } p++; @@ -3128,7 +3127,7 @@ TQImage TQImage::createHeuristicMask( bool clipTight ) const Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on whether \a horizontal and \a - vertical are set to TRUE or FALSE. The original image is not + vertical are set to true or false. The original image is not changed. \sa smoothScale() @@ -3231,7 +3230,7 @@ TQImage TQImage::mirror(bool horizontal, bool vertical) const TQImage TQImage::mirror() const { - return mirror(FALSE,TRUE); + return mirror(false,true); } #endif //TQT_NO_IMAGE_MIRROR @@ -3368,8 +3367,8 @@ TQStrList TQImage::outputFormats() /*! - Loads an image from the file \a fileName. Returns TRUE if the - image was successfully loaded; otherwise returns FALSE. + Loads an image from the file \a fileName. Returns true if the + image was successfully loaded; otherwise returns false. If \a format is specified, the loader attempts to read the image using the specified format. If \a format is not specified (which @@ -3393,8 +3392,8 @@ bool TQImage::load( const TQString &fileName, const char* format ) /*! Loads an image from the first \a len bytes of binary data in \a - buf. Returns TRUE if the image was successfully loaded; otherwise - returns FALSE. + buf. Returns true if the image was successfully loaded; otherwise + returns false. If \a format is specified, the loader attempts to read the image using the specified format. If \a format is not specified (which @@ -3439,8 +3438,8 @@ bool TQImage::loadFromData( TQByteArray buf, const char *format ) compressed files, 100 for large uncompressed files, and -1 (the default) to use the default settings. - Returns TRUE if the image was successfully saved; otherwise - returns FALSE. + Returns true if the image was successfully saved; otherwise + returns false. \sa load() loadFromData() imageFormat() TQPixmap::save() TQImageIO */ @@ -3448,7 +3447,7 @@ bool TQImage::loadFromData( TQByteArray buf, const char *format ) bool TQImage::save( const TQString &fileName, const char* format, int quality ) const { if ( isNull() ) - return FALSE; // nothing to save + return false; // nothing to save TQImageIO io( fileName, format ); return doImageIO( &io, quality ); } @@ -3471,7 +3470,7 @@ bool TQImage::save( const TQString &fileName, const char* format, int quality ) bool TQImage::save( TQIODevice* device, const char* format, int quality ) const { if ( isNull() ) - return FALSE; // nothing to save + return false; // nothing to save TQImageIO io( device, format ); return doImageIO( &io, quality ); } @@ -3482,7 +3481,7 @@ bool TQImage::save( TQIODevice* device, const char* format, int quality ) const bool TQImage::doImageIO( TQImageIO* io, int quality ) const { if ( !io ) - return FALSE; + return false; io->setImage( *this ); #if defined(QT_CHECK_RANGE) if ( quality > 100 || quality < -1 ) @@ -3822,7 +3821,7 @@ void tqt_init_image_handlers() // initialize image handlers if ( !imageHandlers ) { imageHandlers = new TQIHList; TQ_CHECK_PTR( imageHandlers ); - imageHandlers->setAutoDelete( TRUE ); + imageHandlers->setAutoDelete( true ); tqAddPostRoutine( cleanup ); #ifndef TQT_NO_IMAGEIO_BMP TQImageIO::defineIOHandler( "BMP", "^BM", 0, @@ -4303,8 +4302,8 @@ TQStrList TQImageIO::outputFormats() /*! - Reads an image into memory and returns TRUE if the image was - successfully read; otherwise returns FALSE. + Reads an image into memory and returns true if the image was + successfully read; otherwise returns false. Before reading an image you must set an IO device or a file name. If both an IO device and a file name have been set, the IO device @@ -4340,10 +4339,10 @@ bool TQImageIO::read() } else if ( !fname.isEmpty() ) { // read from file file.setName( fname ); if ( !file.open(IO_ReadOnly) ) - return FALSE; // cannot open file + return false; // cannot open file iodev = &file; } else { // no file name or io device - return FALSE; + return false; } if (frmt.isEmpty()) { // Try to guess format @@ -4353,7 +4352,7 @@ bool TQImageIO::read() file.close(); iodev = 0; } - return FALSE; + return false; } } else { image_format = frmt; @@ -4391,8 +4390,8 @@ bool TQImageIO::read() /*! - Writes an image to an IO device and returns TRUE if the image was - successfully written; otherwise returns FALSE. + Writes an image to an IO device and returns true if the image was + successfully written; otherwise returns false. Before writing an image you must set an IO device or a file name. If both an IO device and a file name have been set, the IO device @@ -4409,7 +4408,7 @@ bool TQImageIO::read() iio.setFileName( "vegeburger.bmp" ); iio.setFormat( "BMP" ); if ( iio.write() ) - // returned TRUE if written successfully + // returned true if written successfully \endcode \sa setIODevice() setFileName() setFormat() read() TQPixmap::save() @@ -4418,7 +4417,7 @@ bool TQImageIO::read() bool TQImageIO::write() { if ( frmt.isEmpty() ) - return FALSE; + return false; TQImageHandler *h = get_image_handler( frmt ); if ( !h && !plugin_manager) { tqt_init_image_plugins(); @@ -4429,7 +4428,7 @@ bool TQImageIO::write() tqWarning( "TQImageIO::write: No such image format handler: %s", format() ); #endif - return FALSE; + return false; } TQFile file; if ( !iodev && !fname.isEmpty() ) { @@ -4437,7 +4436,7 @@ bool TQImageIO::write() bool translate = h->text_mode==TQImageHandler::TranslateInOut; int fmode = translate ? IO_WriteOnly|IO_Translate : IO_WriteOnly; if ( !file.open(fmode) ) // couldn't create file - return FALSE; + return false; iodev = &file; } iostat = 1; @@ -4559,7 +4558,7 @@ bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image ) s >> bi; // read BMP info header if ( d->atEnd() ) // end of stream/file - return FALSE; + return false; #if 0 tqDebug( "offset...........%d", offset ); tqDebug( "startpos.........%d", startpos ); @@ -4587,12 +4586,12 @@ bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image ) if ( !(nbits == 1 || nbits == 4 || nbits == 8 || nbits == 16 || nbits == 24 || nbits == 32) || bi.biPlanes != 1 || comp > BMP_BITFIELDS ) - return FALSE; // weird BMP image + return false; // weird BMP image if ( !(comp == BMP_RGB || (nbits == 4 && comp == BMP_RLE4) || (nbits == 8 && comp == BMP_RLE8) || ((nbits == 16 || nbits == 32) && comp == BMP_BITFIELDS)) ) - return FALSE; // weird compression type + return false; // weird compression type if ((w < 0) || ((w * abs(h)) > (16384 * 16384))) - return FALSE; + return false; int ncols; int depth; @@ -4617,7 +4616,7 @@ bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image ) image.create( w, h, depth, ncols, nbits == 1 ? TQImage::BigEndian : TQImage::IgnoreEndian ); if ( image.isNull() ) // could not create image - return FALSE; + return false; image.setDotsPerMeterX( bi.biXPelsPerMeter ); image.setDotsPerMeterY( bi.biYPelsPerMeter ); @@ -4629,29 +4628,29 @@ bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image ) int rgb_len = t == BMP_OLD ? 3 : 4; for ( int i=0; i<ncols; i++ ) { if ( d->readBlock( (char *)rgb, rgb_len ) != rgb_len ) - return FALSE; + return false; image.setColor( i, tqRgb(rgb[2],rgb[1],rgb[0]) ); if ( d->atEnd() ) // truncated file - return FALSE; + return false; } } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { if ( (TQ_ULONG)d->readBlock( (char *)&red_mask, sizeof(red_mask) ) != sizeof(red_mask) ) - return FALSE; + return false; if ( (TQ_ULONG)d->readBlock( (char *)&green_mask, sizeof(green_mask) ) != sizeof(green_mask) ) - return FALSE; + return false; if ( (TQ_ULONG)d->readBlock( (char *)&blue_mask, sizeof(blue_mask) ) != sizeof(blue_mask) ) - return FALSE; + return false; red_shift = calc_shift(red_mask); if (((red_mask >> red_shift) + 1) == 0) - return FALSE; + return false; red_scale = 256 / ((red_mask >> red_shift) + 1); green_shift = calc_shift(green_mask); if (((green_mask >> green_shift) + 1) == 0) - return FALSE; + return false; green_scale = 256 / ((green_mask >> green_shift) + 1); blue_shift = calc_shift(blue_mask); if (((blue_mask >> blue_shift) + 1) == 0) - return FALSE; + return false; blue_scale = 256 / ((blue_mask >> blue_shift) + 1); } else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) { blue_mask = 0x000000ff; @@ -4662,7 +4661,7 @@ bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image ) red_shift = 16; blue_scale = green_scale = red_scale = 1; } else if (comp == BMP_RGB && nbits == 16) // don't support RGB values for 15/16 bpp - return FALSE; + return false; // offset can be bogus, be careful if (offset>=0 && startpos + offset > (TQ_LONG)d->at() ) @@ -4801,7 +4800,7 @@ bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image ) b = endp-p; if ( d->readBlock( (char *)p, b ) != b ) - return FALSE; + return false; if ( (b & 1) == 1 ) d->getch(); // align on word boundary x += b; @@ -4852,7 +4851,7 @@ bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image ) delete[] buf24; } - return TRUE; + return true; } bool qt_read_dib( TQDataStream& s, TQImage& image ) @@ -4938,7 +4937,7 @@ bool qt_write_dib( TQDataStream& s, TQImage image ) for ( y=image.height()-1; y>=0; y-- ) { d->writeBlock( (char*)image.scanLine(y), bpl ); } - return TRUE; + return true; } uchar *buf = new uchar[bpl_bmp]; @@ -4970,11 +4969,11 @@ bool qt_write_dib( TQDataStream& s, TQImage image ) } if ( bpl_bmp != d->writeBlock( (char*)buf, bpl_bmp ) ) { delete[] buf; - return FALSE; + return false; } } delete[] buf; - return TRUE; + return true; } @@ -5581,14 +5580,14 @@ static void write_xbm_image( TQImageIO *iio ) // Skip until ", read until the next ", return the rest in *buf -// Returns FALSE on error, TRUE on success +// Returns false on error, true on success static bool read_xpm_string( TQCString &buf, TQIODevice *d, const char * const *source, int &index ) { if ( source ) { buf = source[index++]; - return TRUE; + return true; } if ( buf.size() < 69 ) //# just an approximation @@ -5599,7 +5598,7 @@ static bool read_xpm_string( TQCString &buf, TQIODevice *d, int i; while ( (c=d->getch()) != EOF && c != '"' ) { } if ( c == EOF ) { - return FALSE; + return false; } i = 0; while ( (c=d->getch()) != EOF && c != '"' ) { @@ -5608,13 +5607,13 @@ static bool read_xpm_string( TQCString &buf, TQIODevice *d, buf[i++] = c; } if ( c == EOF ) { - return FALSE; + return false; } if ( i == (int)buf.size() ) // always use a 0 terminator buf.resize( i+1 ); buf[i] = '\0'; - return TRUE; + return true; } @@ -5706,7 +5705,7 @@ static void read_xpm_image_or_array( TQImageIO * iio, const char * const * sourc buf.truncate(end); buf = buf.stripWhiteSpace(); if ( buf == "none" ) { - image.setAlphaBuffer( TRUE ); + image.setAlphaBuffer( true ); int transparentColor = currentColor; if ( image.depth() == 8 ) { image.setColor( transparentColor, @@ -5955,14 +5954,14 @@ static bool haveSamePalette(const TQImage& a, const TQImage& b) { - if (a.depth() != b.depth()) return FALSE; - if (a.numColors() != b.numColors()) return FALSE; + if (a.depth() != b.depth()) return false; + if (a.numColors() != b.numColors()) return false; TQRgb* ca = a.colorTable(); TQRgb* cb = b.colorTable(); for (int i=a.numColors(); i--; ) { - if (*ca++ != *cb++) return FALSE; + if (*ca++ != *cb++) return false; } - return TRUE; + return true; } /*! @@ -6157,8 +6156,8 @@ void bitBlt( TQImage* dst, int dx, int dy, const TQImage* src, /*! - Returns TRUE if this image and image \a i have the same contents; - otherwise returns FALSE. The comparison can be slow, unless there + Returns true if this image and image \a i have the same contents; + otherwise returns false. The comparison can be slow, unless there is some obvious difference, such as different widths, in which case the function will return quickly. @@ -6169,14 +6168,14 @@ bool TQImage::operator==( const TQImage & i ) const { // same object, or shared? if ( i.data == data ) - return TRUE; + return true; // obviously different stuff? if ( i.data->h != data->h || i.data->w != data->w ) - return FALSE; + return false; // not equal if one has alphabuffer and the other does not if ( i.hasAlphaBuffer() != hasAlphaBuffer() ) - return FALSE; + return false; // that was the fast bit... TQImage i1 = convertDepth( 32 ); TQImage i2 = i.convertDepth( 32 ); @@ -6193,21 +6192,21 @@ bool TQImage::operator==( const TQImage & i ) const // compare pixels of scanline individually for ( m=0; m < data->w; m++ ) if ( (i1line[m] ^ i2line[m]) & 0x00FFFFFF ) - return FALSE; + return false; } } else { // yay, we can do fast binary comparison on entire scanlines for( l=0; l < data->h; l++ ) if ( memcmp( i1.scanLine( l ), i2.scanLine( l ), 4*data->w ) ) - return FALSE; + return false; } - return TRUE; + return true; } /*! - Returns TRUE if this image and image \a i have different contents; - otherwise returns FALSE. The comparison can be slow, unless there + Returns true if this image and image \a i have different contents; + otherwise returns false. The comparison can be slow, unless there is some obvious difference, such as different widths, in which case the function will return quickly. |
