summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmapdata.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-10-13 15:01:54 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-10-14 11:45:59 (GMT)
commitd310f7c710ecb331a9689861f0551eabd38e946e (patch)
tree66d83a8aea452f8e42b449936e4787fe4c45d7c4 /src/gui/image/qpixmapdata.cpp
parent997dbe14d8bd4f370a7c972b594b5bc12e80f027 (diff)
downloadQt-d310f7c710ecb331a9689861f0551eabd38e946e.zip
Qt-d310f7c710ecb331a9689861f0551eabd38e946e.tar.gz
Qt-d310f7c710ecb331a9689861f0551eabd38e946e.tar.bz2
Added QPixmapData::createCompatiblePixmapData() used by QPixmap::copy().
QPixmap::copy() now returns a pixmap with the same pixmap backend. Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src/gui/image/qpixmapdata.cpp')
-rw-r--r--src/gui/image/qpixmapdata.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp
index 93fc2eb..1ad1f02 100644
--- a/src/gui/image/qpixmapdata.cpp
+++ b/src/gui/image/qpixmapdata.cpp
@@ -43,6 +43,8 @@
#include <QtCore/qbuffer.h>
#include <QtGui/qbitmap.h>
#include <QtGui/qimagereader.h>
+#include <private/qgraphicssystem_p.h>
+#include <private/qapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -67,6 +69,17 @@ QPixmapData::~QPixmapData()
{
}
+QPixmapData *QPixmapData::createCompatiblePixmapData() const
+{
+ QPixmapData *d;
+ QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
+ if (gs)
+ d = gs->createPixmapData(pixelType());
+ else
+ d = QGraphicsSystem::createDefaultPixmapData(pixelType());
+ return d;
+}
+
static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Qt::ImageConversionFlags flags)
{
if (d->pixelType() == QPixmapData::BitmapType) {