diff options
Diffstat (limited to 'src/kernel/qimage.cpp')
| -rw-r--r-- | src/kernel/qimage.cpp | 253 |
1 files changed, 126 insertions, 127 deletions
diff --git a/src/kernel/qimage.cpp b/src/kernel/qimage.cpp index ce95f1cb6..9754c5daa 100644 --- a/src/kernel/qimage.cpp +++ b/src/kernel/qimage.cpp @@ -494,12 +494,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); @@ -544,12 +544,12 @@ TQImage::TQImage( uchar* yourdata, int w, int h, int depth, data->nbytes = bpl * h; if ( colortable || !numColors ) { data->ctbl = colortable; - data->ctbl_mine = FALSE; + data->ctbl_mine = false; } else { // calloc since we realloc, etc. later (ick) data->ctbl = (TQRgb*)calloc( numColors*sizeof(TQRgb), numColors ); TQ_CHECK_PTR(data->ctbl); - data->ctbl_mine = TRUE; + data->ctbl_mine = true; } uchar** jt = (uchar**)malloc(h*sizeof(uchar*)); TQ_CHECK_PTR(jt); @@ -734,14 +734,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(); @@ -769,7 +769,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. */ @@ -1047,7 +1047,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 @@ -1155,7 +1155,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; @@ -1169,7 +1169,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; } @@ -1178,14 +1178,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 @@ -1214,8 +1214,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 @@ -1239,12 +1239,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; @@ -1265,18 +1265,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; } // TQt/Embedded doesn't waste memory on unnecessary padding. #ifdef TQ_WS_QWS @@ -1291,7 +1291,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 @@ -1300,7 +1300,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; @@ -1316,7 +1316,7 @@ bool TQImage::create( int width, int height, int depth, int numColors, memset( d+bpl-pad, 0, pad ); d += bpl; } - return TRUE; + return true; } /*! @@ -1347,7 +1347,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 @@ -1394,18 +1394,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. @@ -1439,7 +1439,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); @@ -1460,7 +1460,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(); @@ -1692,14 +1692,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); @@ -1708,14 +1708,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); @@ -1735,14 +1735,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 @@ -1773,7 +1773,7 @@ static bool convert_1_to_8( const TQImage *src, TQImage *dst ) } } } - return TRUE; + return true; } #ifndef TQT_NO_IMAGE_DITHER_TO_1 @@ -1785,7 +1785,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; @@ -1832,7 +1832,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; @@ -2062,7 +2062,7 @@ static bool dither_to_1( const TQImage *src, TQImage *dst, } } } - return TRUE; + return true; } #endif @@ -2080,7 +2080,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); @@ -2089,14 +2089,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); @@ -2105,7 +2105,7 @@ static bool convert_32_to_16( const TQImage *src, TQImage *dst ) while ( p < end ) *p++ = qt_convRgbTo16( *s++ ); } - return TRUE; + return true; } @@ -2135,7 +2135,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 @@ -2180,8 +2180,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() */ @@ -2382,9 +2382,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 16-bit (TQt/Embedded only) and 32-bit images. @@ -2398,33 +2398,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 16-bit (TQt/Embedded only) and 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() */ @@ -2441,11 +2441,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 @@ -2504,7 +2504,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; @@ -3058,7 +3058,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; } @@ -3073,7 +3072,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 @@ -3091,7 +3090,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 @@ -3133,10 +3132,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++ ) { @@ -3154,7 +3153,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++; @@ -3204,7 +3203,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() @@ -3307,7 +3306,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 @@ -3444,8 +3443,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 @@ -3469,8 +3468,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 @@ -3515,8 +3514,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 */ @@ -3524,7 +3523,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 ); } @@ -3547,7 +3546,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 ); } @@ -3558,7 +3557,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 ) @@ -3898,7 +3897,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, @@ -4379,8 +4378,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 @@ -4416,10 +4415,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 @@ -4429,7 +4428,7 @@ bool TQImageIO::read() file.close(); iodev = 0; } - return FALSE; + return false; } } else { image_format = frmt; @@ -4467,8 +4466,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 @@ -4485,7 +4484,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() @@ -4494,7 +4493,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(); @@ -4505,7 +4504,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() ) { @@ -4513,7 +4512,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; @@ -4635,7 +4634,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 ); @@ -4663,12 +4662,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; @@ -4693,7 +4692,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 ); @@ -4705,29 +4704,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; @@ -4738,7 +4737,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() ) @@ -4891,7 +4890,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; @@ -4946,7 +4945,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 ) @@ -5046,7 +5045,7 @@ bool qt_write_dib( TQDataStream& s, TQImage image ) d->writeBlock( padding, pad ); #endif } - return TRUE; + return true; } uchar *buf = new uchar[bpl_bmp]; @@ -5078,11 +5077,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; } @@ -5689,14 +5688,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 @@ -5707,7 +5706,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 != '"' ) { @@ -5716,13 +5715,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; } @@ -5814,7 +5813,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, @@ -6063,14 +6062,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; } /*! @@ -6265,8 +6264,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. @@ -6277,14 +6276,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 ); @@ -6301,21 +6300,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. |
