diff options
-rw-r--r-- | mkspecs/common/g++.conf | 2 | ||||
-rw-r--r-- | mkspecs/common/linux.conf | 4 | ||||
-rw-r--r-- | src/corelib/global/qendian.h | 1 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 10 | ||||
-rw-r--r-- | src/plugins/imageformats/gif/qgifhandler.cpp | 49 |
5 files changed, 28 insertions, 38 deletions
diff --git a/mkspecs/common/g++.conf b/mkspecs/common/g++.conf index b3d6296..d3db24a 100644 --- a/mkspecs/common/g++.conf +++ b/mkspecs/common/g++.conf @@ -7,7 +7,7 @@ QMAKE_CFLAGS += -pipe QMAKE_CFLAGS_DEPS += -M QMAKE_CFLAGS_WARN_ON += -Wall -W QMAKE_CFLAGS_WARN_OFF += -w -QMAKE_CFLAGS_RELEASE += -g -O2 +QMAKE_CFLAGS_RELEASE += -O2 QMAKE_CFLAGS_DEBUG += -g QMAKE_CFLAGS_SHLIB += -fPIC QMAKE_CFLAGS_STATIC_LIB += -fPIC diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf index 320ae71..4fbe2dc 100644 --- a/mkspecs/common/linux.conf +++ b/mkspecs/common/linux.conf @@ -51,8 +51,8 @@ QMAKE_COPY_DIR = $(COPY) -r QMAKE_MOVE = mv -f QMAKE_DEL_FILE = rm -f QMAKE_DEL_DIR = rmdir -#QMAKE_STRIP = strip -#QMAKE_STRIPFLAGS_LIB += --strip-unneeded +QMAKE_STRIP = strip +QMAKE_STRIPFLAGS_LIB += --strip-unneeded QMAKE_CHK_DIR_EXISTS = test -d QMAKE_MKDIR = mkdir -p QMAKE_INSTALL_FILE = install -m 644 -p diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 01550cf..353e8b9 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -43,7 +43,6 @@ #define QENDIAN_H #ifdef Q_OS_LINUX -# include <qglobal.h> QT_BEGIN_INCLUDE_NAMESPACE # include <features.h> QT_END_INCLUDE_NAMESPACE diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 6408432..98f235e 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -245,11 +245,6 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format, int nu return 0; } - if (d->nbytes == 15840000) - { - d->nbytes = 15840000; - } - d->ref.ref(); return d.take(); @@ -903,11 +898,6 @@ QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QIm d->bytes_per_line = bpl; d->nbytes = d->bytes_per_line * height; - if (d->nbytes == 15840000) - { - d->nbytes = 15840000; - } - return d; } diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index fa89f0a..8abc2d1 100644 --- a/src/plugins/imageformats/gif/qgifhandler.cpp +++ b/src/plugins/imageformats/gif/qgifhandler.cpp @@ -78,8 +78,8 @@ public: bool partialNewFrame; private: - void fillRect(QImage *image, int x, int y, int w, int h, uchar col); - //inline uchar color(uchar index) const; + void fillRect(QImage *image, int x, int y, int w, int h, QRgb col); + inline QRgb color(uchar index) const; // GIF specific stuff QRgb* globalcmap; @@ -197,13 +197,13 @@ void QGIFFormat::disposePrevious(QImage *image) case RestoreBackground: if (trans_index>=0) { // Easy: we use the transparent color - fillRect(image, l, t, r-l+1, b-t+1, trans_index); + fillRect(image, l, t, r-l+1, b-t+1, Q_TRANSPARENT); } else if (bgcol>=0) { // Easy: we use the bgcol given - fillRect(image, l, t, r-l+1, b-t+1, bgcol); + fillRect(image, l, t, r-l+1, b-t+1, color(bgcol)); } else { // Impossible: We don't know of a bgcol - use pixel 0 - const uchar *bits = image->constBits(); + QRgb *bits = (QRgb*)image->bits(); fillRect(image, l, t, r-l+1, b-t+1, bits[0]); } // ### Changed: QRect(l, t, r-l+1, b-t+1) @@ -211,7 +211,9 @@ void QGIFFormat::disposePrevious(QImage *image) case RestoreImage: { if (frame >= 0) { for (int ln=t; ln<=b; ln++) { - memcpy(image->scanLine(ln)+l, backingstore.constScanLine(ln-t), (r-l+1)); + memcpy(image->scanLine(ln)+l, + backingstore.scanLine(ln-t), + (r-l+1)*sizeof(QRgb)); } // ### Changed: QRect(l, t, r-l+1, b-t+1) } @@ -339,8 +341,9 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, if (sheight <= 0) sheight = newtop + newheight; + QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32; if (image->isNull()) { - (*image) = QImage(swidth, sheight, QImage::Format_Indexed8); + (*image) = QImage(swidth, sheight, format); bpl = image->bytesPerLine(); bits = image->bits(); memset(bits, 0, image->byteCount()); @@ -374,10 +377,10 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, if (left || top || width<swidth || height<sheight) { // Not full-size image - erase with bg or transparent if (trans_index >= 0) { - fillRect(image, 0, 0, swidth, sheight, trans_index); + fillRect(image, 0, 0, swidth, sheight, color(trans_index)); // ### Changed: QRect(0, 0, swidth, sheight) } else if (bgcol>=0) { - fillRect(image, 0, 0, swidth, sheight, bgcol); + fillRect(image, 0, 0, swidth, sheight, color(bgcol)); // ### Changed: QRect(0, 0, swidth, sheight) } } @@ -396,7 +399,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, // We just use the backing store as a byte array backingstore = QImage(qMax(backingstore.width(), w), qMax(backingstore.height(), h), - QImage::Format_Indexed8); + QImage::Format_RGB32); memset(bits, 0, image->byteCount()); } const int dest_bpl = backingstore.bytesPerLine(); @@ -476,7 +479,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, if (needfirst) { firstcode=oldcode=code; if (!out_of_bounds && image->height() > y && firstcode!=trans_index) - FAST_SCAN_LINE(bits, bpl, y)[x] = firstcode; + ((QRgb*)FAST_SCAN_LINE(bits, bpl, y))[x] = color(firstcode); x++; if (x>=swidth) out_of_bounds = true; needfirst=false; @@ -906,11 +909,11 @@ void QGIFFormat::scan(QIODevice *device, QVector<QSize> *imageSizes, int *loopCo return; } -void QGIFFormat::fillRect(QImage *image, int col, int row, int w, int h, uchar color) +void QGIFFormat::fillRect(QImage *image, int col, int row, int w, int h, QRgb color) { if (w>0) { for (int j=0; j<h; j++) { - uchar *line = (uchar*)image->scanLine(j+row); + QRgb *line = (QRgb*)image->scanLine(j+row); for (int i=0; i<w; i++) *(line+col+i) = color; } @@ -933,8 +936,8 @@ void QGIFFormat::nextY(unsigned char *bits, int bpl) // Don't dup with transparency if (trans_index < 0) { for (i=1; i<=my; i++) { - memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(uchar), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(uchar), - (right-left+1)*sizeof(uchar)); + memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb), + (right-left+1)*sizeof(QRgb)); } } @@ -962,8 +965,8 @@ void QGIFFormat::nextY(unsigned char *bits, int bpl) // Don't dup with transparency if (trans_index < 0) { for (i=1; i<=my; i++) { - memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(uchar), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(uchar), - (right-left+1)*sizeof(uchar)); + memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb), + (right-left+1)*sizeof(QRgb)); } } @@ -986,8 +989,8 @@ void QGIFFormat::nextY(unsigned char *bits, int bpl) // Don't dup with transparency if (trans_index < 0) { for (i=1; i<=my; i++) { - memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(uchar), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(uchar), - (right-left+1)*sizeof(uchar)); + memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb), + (right-left+1)*sizeof(QRgb)); } } // if (!out_of_bounds) { @@ -1007,16 +1010,14 @@ void QGIFFormat::nextY(unsigned char *bits, int bpl) if (y >= sheight) out_of_bounds=true; //y=bottom; } -#if 0 -inline uchar QGIFFormat::color(uchar index) const +inline QRgb QGIFFormat::color(uchar index) const { if (index == trans_index || index > ncols) - return trans_index; + return Q_TRANSPARENT; - uchar *map = lcmap ? localcmap : globalcmap; + QRgb *map = lcmap ? localcmap : globalcmap; return map ? map[index] : 0; } -#endif //------------------------------------------------------------------------- //------------------------------------------------------------------------- |