summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-09-13 10:26:03 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-09-13 10:46:16 (GMT)
commit06dc8791a70329dc8e985a0eed7e434d1f762ec5 (patch)
treef3a9f55307207088676d4c48ec67ec418fa56053 /src/gui/image
parent59a2ff150795e1281e6b4fea435e74d3434a5ad2 (diff)
parent31cc0b1820c0c8fdfdbc3d5b804f2dba2051c96f (diff)
downloadQt-06dc8791a70329dc8e985a0eed7e434d1f762ec5.zip
Qt-06dc8791a70329dc8e985a0eed7e434d1f762ec5.tar.gz
Qt-06dc8791a70329dc8e985a0eed7e434d1f762ec5.tar.bz2
Merge remote branch 'qt/master' into lighthouse-master
Conflicts: configure src/corelib/global/qglobal.h src/corelib/tools/qsimd.cpp
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qicon.h4
-rw-r--r--src/gui/image/qimage.h5
-rw-r--r--src/gui/image/qpicture.h4
-rw-r--r--src/gui/image/qpixmap.h4
-rw-r--r--src/gui/image/qpixmap_s60.cpp47
-rw-r--r--src/gui/image/qpixmap_s60_p.h7
6 files changed, 68 insertions, 3 deletions
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index faef07b..fd591e6 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -71,6 +71,10 @@ public:
explicit QIcon(QIconEngineV2 *engine);
~QIcon();
QIcon &operator=(const QIcon &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ inline QIcon &operator=(QIcon &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
operator QVariant() const;
QPixmap pixmap(const QSize &size, Mode mode = Normal, State state = Off) const;
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index db7a4cc..003daea 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -140,6 +140,11 @@ public:
~QImage();
QImage &operator=(const QImage &);
+#ifdef Q_COMPILER_RVALUE_REFS
+ inline QImage &operator=(QImage &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
+
bool isNull() const;
int devType() const;
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index 63ef42e..49b0fd6 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -81,6 +81,10 @@ public:
void setBoundingRect(const QRect &r);
QPicture& operator=(const QPicture &p);
+#ifdef Q_COMPILER_RVALUE_REFS
+ inline QPicture &operator=(QPicture &&other)
+ { qSwap(d_ptr, other.d_ptr); return *this; }
+#endif
void detach();
bool isDetached() const;
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 64ca8a3..e9f9365 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -83,6 +83,10 @@ public:
~QPixmap();
QPixmap &operator=(const QPixmap &);
+#ifdef Q_COMPILER_RVALUE_REFS
+ inline QPixmap &operator=(QPixmap &&other)
+ { qSwap(data, other.data); return *this; }
+#endif
operator QVariant() const;
bool isNull() const; // ### Qt 5: make inline
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 9d571b5..47249d9 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -63,6 +63,45 @@ QT_BEGIN_NAMESPACE
const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
0x10, 0x20, 0x40, 0x80 };
+static bool cleanup_function_registered = false;
+static QS60PixmapData *firstPixmap = 0;
+
+// static
+void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd)
+{
+ if (!cleanup_function_registered) {
+ qAddPostRoutine(qt_symbian_release_pixmaps);
+ cleanup_function_registered = true;
+ }
+
+ pd->next = firstPixmap;
+ pd->prev = 0;
+ if (firstPixmap)
+ firstPixmap->prev = pd;
+ firstPixmap = pd;
+}
+
+// static
+void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd)
+{
+ if (pd->next)
+ pd->next->prev = pd->prev;
+ if (pd->prev)
+ pd->prev->next = pd->next;
+ else
+ firstPixmap = pd->next;
+}
+
+// static
+void QS60PixmapData::qt_symbian_release_pixmaps()
+{
+ // Scan all QS60PixmapData objects in the system and destroy them.
+ QS60PixmapData *pd = firstPixmap;
+ while (pd != 0) {
+ pd->release();
+ pd = pd->next;
+ }
+}
/*
\class QSymbianFbsClient
@@ -356,15 +395,18 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
cfbsBitmap(0),
pengine(0),
bytes(0),
- formatLocked(false)
+ formatLocked(false),
+ next(0),
+ prev(0)
{
-
+ qt_symbian_register_pixmap(this);
}
QS60PixmapData::~QS60PixmapData()
{
release();
delete symbianBitmapDataAccess;
+ qt_symbian_unregister_pixmap(this);
}
void QS60PixmapData::resize(int width, int height)
@@ -789,7 +831,6 @@ void* QS60PixmapData::toNativeType(NativeType type)
bool convertToArgb32 = false;
bool needsCopy = false;
- QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
if (!(S60->supportsPremultipliedAlpha)) {
// Convert argb32_premultiplied to argb32 since Symbian 9.2 does
// not support premultipied format.
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index 85c9ebe..42cc830 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -120,6 +120,13 @@ private:
bool formatLocked;
+ QS60PixmapData *next;
+ QS60PixmapData *prev;
+
+ static void qt_symbian_register_pixmap(QS60PixmapData *pd);
+ static void qt_symbian_unregister_pixmap(QS60PixmapData *pd);
+ static void qt_symbian_release_pixmaps();
+
friend class QPixmap;
friend class QS60WindowSurface;
friend class QS60PaintEngine;