summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-10-29 13:28:36 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-10-29 14:18:30 (GMT)
commit4531ffbd8aa2cc0ae656715e449caca1649c18b9 (patch)
tree31432fbebde717f08469d77ee88b3de8f97914df /src/gui/image
parent7881773800c05c09f0e85a80c1cbb678981bd6c0 (diff)
downloadQt-4531ffbd8aa2cc0ae656715e449caca1649c18b9.zip
Qt-4531ffbd8aa2cc0ae656715e449caca1649c18b9.tar.gz
Qt-4531ffbd8aa2cc0ae656715e449caca1649c18b9.tar.bz2
Added QImagePixmapCleanupHooks functions for enabling hooks.
Better than having to befriend QPixmapData and setting is_cached manually. Reviewed-by: Tom Cooksey
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp18
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks_p.h4
-rw-r--r--src/gui/image/qpixmapdata_p.h3
3 files changed, 22 insertions, 3 deletions
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index ac30646..35322e9 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -40,7 +40,8 @@
****************************************************************************/
#include "qimagepixmapcleanuphooks_p.h"
-#include "qpixmapdata_p.h"
+#include "private/qpixmapdata_p.h"
+#include "private/qimage_p.h"
QT_BEGIN_NAMESPACE
@@ -132,4 +133,19 @@ void QImagePixmapCleanupHooks::executeImageHooks(qint64 key)
qt_image_cleanup_hook_64(key);
}
+void QImagePixmapCleanupHooks::enableCleanupHooks(const QPixmap &pixmap)
+{
+ enableCleanupHooks(const_cast<QPixmap &>(pixmap).data_ptr().data());
+}
+
+void QImagePixmapCleanupHooks::enableCleanupHooks(QPixmapData *pixmapData)
+{
+ pixmapData->is_cached = true;
+}
+
+void QImagePixmapCleanupHooks::enableCleanupHooks(const QImage &image)
+{
+ const_cast<QImage &>(image).data_ptr()->is_cached = true;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h
index 16c8974..9e490d7 100644
--- a/src/gui/image/qimagepixmapcleanuphooks_p.h
+++ b/src/gui/image/qimagepixmapcleanuphooks_p.h
@@ -70,6 +70,10 @@ public:
static QImagePixmapCleanupHooks *instance();
+ static void enableCleanupHooks(const QImage &image);
+ static void enableCleanupHooks(const QPixmap &pixmap);
+ static void enableCleanupHooks(QPixmapData *pixmapData);
+
// Gets called when a pixmap is about to be modified:
void addPixmapModificationHook(_qt_pixmap_cleanup_hook_pm);
diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h
index 2f4f201..e99409c 100644
--- a/src/gui/image/qpixmapdata_p.h
+++ b/src/gui/image/qpixmapdata_p.h
@@ -131,12 +131,11 @@ protected:
private:
friend class QPixmap;
- friend class QGLContextPrivate;
friend class QX11PixmapData;
friend class QS60PixmapData;
+ friend class QImagePixmapCleanupHooks; // Needs to set is_cached
friend class QGLTextureCache; //Needs to check the reference count
friend class QExplicitlySharedDataPointer<QPixmapData>;
- friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs to set is_cached
QAtomicInt ref;
int detach_no;