summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qbitmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qbitmap.cpp')
-rw-r--r--src/gui/image/qbitmap.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp
index a1497bc..5827dc1 100644
--- a/src/gui/image/qbitmap.cpp
+++ b/src/gui/image/qbitmap.cpp
@@ -265,15 +265,12 @@ QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)
img.setColor(1, c0);
}
- QPixmapData *d;
QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem();
- if (gs)
- d = gs->createPixmapData(QPixmapData::BitmapType);
- else
- d = QGraphicsSystem::createDefaultPixmapData(QPixmapData::BitmapType);
+ QScopedPointer<QPixmapData> data(gs ? gs->createPixmapData(QPixmapData::BitmapType)
+ : QGraphicsSystem::createDefaultPixmapData(QPixmapData::BitmapType));
- d->fromImage(img, flags | Qt::MonoOnly);
- return QPixmap(d);
+ data->fromImage(img, flags | Qt::MonoOnly);
+ return QPixmap(data.take());
}
/*!