summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoahelpers.mm
diff options
context:
space:
mode:
authorTeemu Katajisto <teemu.katajisto@digia.com>2012-10-05 13:48:43 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-08 08:51:09 +0200
commit179437bdbad3fa2f27ea7fc3a4284a844cb30792 (patch)
treea8327fcb729903f8c0de292bb2f769f3cf1b4a05 /src/plugins/platforms/cocoa/qcocoahelpers.mm
parent1bd710cbc77f71451527b9436c2d8935d8526bd5 (diff)
Cocoa: add qWarnining when trying to create 0 width/height CGImages
Add meaningful warnings when trying to create 0 width/height CGImages. This way it is easier to track down the place where valid size is not used. Change-Id: Id261ddf72d5487afcdb1a2a6d0d9079700888545 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoahelpers.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index d950878c28..8841a65844 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -79,6 +79,12 @@ static void drawImageReleaseData (void *info, const void *, size_t)
CGImageRef qt_mac_image_to_cgimage(const QImage &img)
{
+ if (img.width() <= 0 || img.height() <= 0) {
+ qWarning() << Q_FUNC_INFO <<
+ "trying to set" << img.width() << "x" << img.height() << "size for CGImage";
+ return 0;
+ }
+
QImage *image;
if (img.depth() != 32)
image = new QImage(img.convertToFormat(QImage::Format_ARGB32_Premultiplied));