diff options
author | Harald Fernengel <harald@trolltech.com> | 2009-08-03 13:12:46 (GMT) |
---|---|---|
committer | Harald Fernengel <harald@trolltech.com> | 2009-08-03 13:12:46 (GMT) |
commit | 41a83e1ff19ad1396e6001e6b0ac003c701ba55a (patch) | |
tree | 609e40eda10418bbf925002c36552074796b96b6 /src/gui/image | |
parent | d1f3b9df2bc5c57d414da73a7d4f9ed7b25df3db (diff) | |
download | Qt-41a83e1ff19ad1396e6001e6b0ac003c701ba55a.zip Qt-41a83e1ff19ad1396e6001e6b0ac003c701ba55a.tar.gz Qt-41a83e1ff19ad1396e6001e6b0ac003c701ba55a.tar.bz2 |
Squashed commit of the topic/exceptions branch.
Contains some smaller fixes and renaming of macros. Looks big,
but isn't scary at all ;)
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimageiohandler.h | 2 | ||||
-rw-r--r-- | src/gui/image/qmovie.h | 2 | ||||
-rw-r--r-- | src/gui/image/qpaintengine_pic_p.h | 2 | ||||
-rw-r--r-- | src/gui/image/qpicture.h | 2 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 24 | ||||
-rw-r--r-- | src/gui/image/qpixmap_raster.cpp | 10 | ||||
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 4 | ||||
-rw-r--r-- | src/gui/image/qpixmapcache.cpp | 3 | ||||
-rw-r--r-- | src/gui/image/qpixmapfilter_p.h | 8 |
9 files changed, 36 insertions, 21 deletions
diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h index 50508c0..97b2ba2 100644 --- a/src/gui/image/qimageiohandler.h +++ b/src/gui/image/qimageiohandler.h @@ -60,7 +60,7 @@ class QVariant; class QImageIOHandlerPrivate; class Q_GUI_EXPORT QImageIOHandler { - Q_DECLARE_PRIVATE(QImageIOHandler) + Q_DECLARE_SCOPED_PRIVATE(QImageIOHandler) public: QImageIOHandler(); virtual ~QImageIOHandler(); diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index afee789..eda5aa1 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -74,7 +74,7 @@ class QMoviePrivate; class Q_GUI_EXPORT QMovie : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QMovie) + Q_DECLARE_SCOPED_PRIVATE(QMovie) Q_ENUMS(MovieState CacheMode) Q_PROPERTY(int speed READ speed WRITE setSpeed) Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode) diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h index 1e6413e..2aaa5f0 100644 --- a/src/gui/image/qpaintengine_pic_p.h +++ b/src/gui/image/qpaintengine_pic_p.h @@ -65,7 +65,7 @@ class QBuffer; class QPicturePaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QPicturePaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QPicturePaintEngine) public: QPicturePaintEngine(); ~QPicturePaintEngine(); diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index c323f0e..4d9af37 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QPicturePrivate; class Q_GUI_EXPORT QPicture : public QPaintDevice { - Q_DECLARE_PRIVATE(QPicture) + Q_DECLARE_SCOPED_PRIVATE(QPicture) public: explicit QPicture(int formatVersion = -1); QPicture(const QPicture &); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index a3b2343..c9478cb 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -268,7 +268,12 @@ QPixmap::QPixmap(const QString& fileName, const char *format, Qt::ImageConversio if (!qt_pixmap_thread_test()) return; - load(fileName, format, flags); + QT_TRY { + load(fileName, format, flags); + } QT_CATCH(...) { + deref(); + QT_RETHROW; + } } /*! @@ -316,12 +321,17 @@ QPixmap::QPixmap(const char * const xpm[]) if (!xpm) return; - QImage image(xpm); - if (!image.isNull()) { - if (data->pixelType() == QPixmapData::BitmapType) - *this = QBitmap::fromImage(image); - else - *this = fromImage(image); + QT_TRY { + QImage image(xpm); + if (!image.isNull()) { + if (data->pixelType() == QPixmapData::BitmapType) + *this = QBitmap::fromImage(image); + else + *this = fromImage(image); + } + } QT_CATCH(...) { + deref(); + QT_RETHROW; } } #endif diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 9cc896b..e0d952a 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -172,9 +172,13 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, } } #endif - w = image.d->width; - h = image.d->height; - d = image.d->depth; + if (image.d) { + w = image.d->width; + h = image.d->height; + d = image.d->depth; + } else { + w = h = d = 0; + } is_null = (w <= 0 || h <= 0); setSerialNumber(image.serialNumber()); diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 132e26e..0460c30 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -82,7 +82,7 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) return QPixmap(); TDisplayMode displayMode = screenDevice->DisplayMode(); - CFbsBitmap* temporary = new (ELeave) CFbsBitmap(); + CFbsBitmap* temporary = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new TInt error = temporary->Create(srcRect.Size(), displayMode); if (error == KErrNone) error = screenDevice->CopyScreenToBitmap(temporary, srcRect); @@ -171,7 +171,7 @@ CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const return 0; } - CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); + CFbsBitmap* bitmap = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new TSize size(width(), height()); if (bitmap->Create(size, mode) != KErrNone) { CBase::Delete(bitmap); diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index baa2969..af13375 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -357,7 +357,8 @@ void QPMCache::resizeKeyArray(int size) { if (size <= keyArraySize || size == 0) return; - keyArray = reinterpret_cast<int *>(realloc(keyArray, size * sizeof(int))); + keyArray = q_check_ptr(reinterpret_cast<int *>(realloc(keyArray, + size * sizeof(int)))); for (int i = keyArraySize; i != size; ++i) keyArray[i] = i + 1; keyArraySize = size; diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h index 51292b3..83fc1b9 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/gui/image/qpixmapfilter_p.h @@ -70,7 +70,7 @@ class QPixmapFilterPrivate; class Q_GUI_EXPORT QPixmapFilter : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapFilter) public: virtual ~QPixmapFilter() = 0; @@ -98,7 +98,7 @@ class QPixmapConvolutionFilterPrivate; class Q_GUI_EXPORT QPixmapConvolutionFilter : public QPixmapFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapConvolutionFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapConvolutionFilter) public: QPixmapConvolutionFilter(QObject *parent = 0); @@ -122,7 +122,7 @@ class QPixmapColorizeFilterPrivate; class Q_GUI_EXPORT QPixmapColorizeFilter : public QPixmapFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapColorizeFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapColorizeFilter) public: QPixmapColorizeFilter(QObject *parent = 0); @@ -138,7 +138,7 @@ class QPixmapDropShadowFilterPrivate; class Q_GUI_EXPORT QPixmapDropShadowFilter : public QPixmapFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapDropShadowFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapDropShadowFilter) public: QPixmapDropShadowFilter(QObject *parent = 0); |