summaryrefslogtreecommitdiff
path: root/src/gui/image/qpixmap.cpp
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-07-27 16:44:27 +0200
committerTom Cooksey <thomas.cooksey@nokia.com>2009-07-28 16:17:45 +0200
commitf4978a5894212dd655a91dbb0db02a89070bb165 (patch)
tree2028648f9304274e21a4ee73f7d16cde7855b462 /src/gui/image/qpixmap.cpp
parent8e9921c43ae0b896aee091e1031b4f42c332332b (diff)
downloadqt4-tools-f4978a5894212dd655a91dbb0db02a89070bb165.tar.gz
Refactor QImage/QPixmap cleanup hooks into a seperate class
The new class alows more than one hook to be installed at a time and, for QPixmaps, the hook is told which pixmap is getting deleted. Reviewed-By: Samuel
Diffstat (limited to 'src/gui/image/qpixmap.cpp')
-rw-r--r--src/gui/image/qpixmap.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 18829f4a83..2674cacf3c 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -43,6 +43,7 @@
#include "qpixmap.h"
#include "qpixmapdata_p.h"
+#include "qimagepixmapcleanuphooks_p.h"
#include "qbitmap.h"
#include "qcolormap.h"
@@ -81,14 +82,6 @@
QT_BEGIN_NAMESPACE
// ### Qt 5: remove
-typedef void (*_qt_pixmap_cleanup_hook)(int);
-Q_GUI_EXPORT _qt_pixmap_cleanup_hook qt_pixmap_cleanup_hook = 0;
-
-// ### Qt 5: rename
-typedef void (*_qt_pixmap_cleanup_hook_64)(qint64);
-Q_GUI_EXPORT _qt_pixmap_cleanup_hook_64 qt_pixmap_cleanup_hook_64 = 0;
-
-// ### Qt 5: remove
Q_GUI_EXPORT qint64 qt_pixmap_id(const QPixmap &pixmap)
{
return pixmap.cacheKey();
@@ -1357,8 +1350,8 @@ bool QPixmap::isDetached() const
void QPixmap::deref()
{
if (data && !data->ref.deref()) { // Destroy image if last ref
- if (data->is_cached && qt_pixmap_cleanup_hook_64)
- qt_pixmap_cleanup_hook_64(cacheKey());
+ if (data->is_cached)
+ QImagePixmapCleanupHooks::executePixmapHooks(this);
delete data;
data = 0;
}
@@ -1897,9 +1890,6 @@ int QPixmap::defaultDepth()
#endif
}
-typedef void (*_qt_pixmap_cleanup_hook_64)(qint64);
-extern _qt_pixmap_cleanup_hook_64 qt_pixmap_cleanup_hook_64;
-
/*!
Detaches the pixmap from shared pixmap data.
@@ -1925,8 +1915,8 @@ void QPixmap::detach()
rasterData->image.detach();
}
- if (data->is_cached && qt_pixmap_cleanup_hook_64 && data->ref == 1)
- qt_pixmap_cleanup_hook_64(cacheKey());
+ if (data->is_cached && data->ref == 1)
+ QImagePixmapCleanupHooks::executePixmapHooks(this);
#if defined(Q_WS_MAC)
QMacPixmapData *macData = id == QPixmapData::MacClass ? static_cast<QMacPixmapData*>(data) : 0;