From 310519d6d11da546b23c1cba307f37c24e0a5c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 15 Jul 2011 14:07:12 +0200 Subject: Rename QPixmapData to QPlatformPixmap. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes the API symmetric with the other Lighthouse APIs. Change-Id: I8a399f3c968ea35d4624711b31f2ac5bb94b7893 Reviewed-on: http://codereview.qt.nokia.com/1735 Reviewed-by: Qt Sanity Bot Reviewed-by: Jørgen Lind --- src/gui/egl/qegl_x11.cpp | 30 ++-- src/gui/egl/qeglcontext_p.h | 2 +- src/gui/image/image.pri | 6 +- src/gui/image/qbitmap.cpp | 12 +- src/gui/image/qbitmap.h | 2 +- src/gui/image/qimage.cpp | 2 +- src/gui/image/qimage.h | 4 +- src/gui/image/qimagepixmapcleanuphooks.cpp | 18 +- src/gui/image/qimagepixmapcleanuphooks_p.h | 16 +- src/gui/image/qpixmap.cpp | 60 +++---- src/gui/image/qpixmap.h | 12 +- src/gui/image/qpixmap_blitter.cpp | 44 ++--- src/gui/image/qpixmap_blitter_p.h | 22 +-- src/gui/image/qpixmap_raster.cpp | 50 +++--- src/gui/image/qpixmap_raster_p.h | 13 +- src/gui/image/qpixmapcache_p.h | 6 +- src/gui/image/qpixmapdata.cpp | 189 --------------------- src/gui/image/qpixmapdata_p.h | 160 ----------------- src/gui/image/qpixmapdatafactory.cpp | 100 ----------- src/gui/image/qpixmapdatafactory_p.h | 81 --------- src/gui/image/qplatformpixmap.cpp | 189 +++++++++++++++++++++ src/gui/image/qplatformpixmap_qpa.h | 160 +++++++++++++++++ src/gui/image/qvolatileimage.cpp | 8 +- src/gui/kernel/qplatformintegration_qpa.cpp | 6 +- src/gui/kernel/qplatformintegration_qpa.h | 4 +- src/gui/painting/qpaintengine.h | 2 +- src/gui/painting/qpaintengine_blitter.cpp | 8 +- src/gui/painting/qpaintengine_blitter_p.h | 4 +- src/gui/painting/qpaintengine_raster.cpp | 22 +-- src/opengl/qgl.cpp | 22 +-- src/opengl/qgl_egl.cpp | 10 +- src/opengl/qgl_p.h | 24 +-- src/opengl/qgl_symbian.cpp | 28 +-- src/opengl/qgl_x11.cpp | 50 +++--- src/opengl/qgl_x11egl.cpp | 78 ++++----- src/opengl/qglpixmapfilter.cpp | 10 +- src/plugins/platforms/cocoa/qcocoaintegration.h | 2 +- src/plugins/platforms/cocoa/qcocoaintegration.mm | 4 +- .../platforms/directfb/qdirectfbblitter.cpp | 6 +- src/plugins/platforms/directfb/qdirectfbblitter.h | 2 +- .../platforms/directfb/qdirectfbconvenience.cpp | 4 +- .../platforms/directfb/qdirectfbconvenience.h | 2 +- src/plugins/platforms/directfb/qdirectfbcursor.cpp | 2 +- .../platforms/directfb/qdirectfbintegration.cpp | 10 +- .../platforms/directfb/qdirectfbintegration.h | 2 +- .../platforms/directfb/qdirectfbwindowsurface.cpp | 2 +- .../platforms/directfb/qdirectfbwindowsurface.h | 2 +- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 6 +- src/plugins/platforms/eglfs/qeglfsintegration.h | 2 +- .../platforms/linuxfb/qlinuxfbintegration.cpp | 4 +- .../platforms/linuxfb/qlinuxfbintegration.h | 2 +- .../platforms/minimal/qminimalintegration.cpp | 4 +- .../platforms/minimal/qminimalintegration.h | 2 +- .../platforms/openkode/qopenkodeintegration.cpp | 6 +- .../platforms/openkode/qopenkodeintegration.h | 2 +- .../openvglite/qgraphicssystem_vglite.cpp | 14 +- .../platforms/openvglite/qgraphicssystem_vglite.h | 2 +- src/plugins/platforms/qvfb/qvfbintegration.cpp | 4 +- src/plugins/platforms/qvfb/qvfbintegration.h | 2 +- src/plugins/platforms/uikit/quikitintegration.h | 2 +- src/plugins/platforms/uikit/quikitintegration.mm | 4 +- src/plugins/platforms/vnc/qvncintegration.cpp | 4 +- src/plugins/platforms/vnc/qvncintegration.h | 2 +- .../platforms/wayland/qwaylandintegration.cpp | 4 +- .../platforms/wayland/qwaylandintegration.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 4 +- src/plugins/platforms/xcb/qxcbintegration.h | 2 +- src/plugins/platforms/xlib/qxlibintegration.cpp | 8 +- src/plugins/platforms/xlib/qxlibintegration.h | 2 +- src/widgets/effects/qpixmapfilter_p.h | 2 +- src/widgets/platforms/mac/qpaintdevice_mac.cpp | 8 +- src/widgets/platforms/mac/qpixmap_mac.cpp | 96 +++++------ src/widgets/platforms/mac/qpixmap_mac_p.h | 20 +-- src/widgets/platforms/s60/qapplication_s60.cpp | 2 +- src/widgets/platforms/s60/qpaintengine_s60.cpp | 30 ++-- src/widgets/platforms/s60/qpaintengine_s60_p.h | 6 +- src/widgets/platforms/s60/qpixmap_s60.cpp | 94 +++++----- src/widgets/platforms/s60/qpixmap_s60_p.h | 18 +- src/widgets/platforms/win/qpixmap_win.cpp | 8 +- src/widgets/platforms/x11/qcursor_x11.cpp | 4 +- src/widgets/platforms/x11/qfontengine_x11.cpp | 2 +- src/widgets/platforms/x11/qpaintengine_x11.cpp | 22 +-- src/widgets/platforms/x11/qpixmap_x11.cpp | 114 ++++++------- src/widgets/platforms/x11/qpixmap_x11_p.h | 24 +-- src/widgets/platforms/x11/qwidget_x11.cpp | 4 +- src/widgets/platforms/x11/qx11info_x11.h | 2 +- src/widgets/styles/qs60style_s60.cpp | 6 +- 87 files changed, 927 insertions(+), 1111 deletions(-) delete mode 100644 src/gui/image/qpixmapdata.cpp delete mode 100644 src/gui/image/qpixmapdata_p.h delete mode 100644 src/gui/image/qpixmapdatafactory.cpp delete mode 100644 src/gui/image/qpixmapdatafactory_p.h create mode 100644 src/gui/image/qplatformpixmap.cpp create mode 100644 src/gui/image/qplatformpixmap_qpa.h (limited to 'src') diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index c0f8a240fb..4fd8a15157 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include @@ -339,14 +339,14 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg return EGL_NO_SURFACE; } - QX11PixmapData *x11PixmapData = 0; + QX11PlatformPixmap *x11PlatformPixmap = 0; if (devType == QInternal::Pixmap) { - QPixmapData *pmd = static_cast(device)->data_ptr().data(); - if (pmd->classId() == QPixmapData::X11Class) - x11PixmapData = static_cast(pmd); + QPlatformPixmap *pmd = static_cast(device)->data_ptr().data(); + if (pmd->classId() == QPlatformPixmap::X11Class) + x11PlatformPixmap = static_cast(pmd); else { - // TODO: Replace the pixmap's data with a new QX11PixmapData - qWarning("WARNING: Creating an EGL surface on a QPixmap is only supported for QX11PixmapData"); + // TODO: Replace the pixmap's data with a new QX11PlatformPixmap + qWarning("WARNING: Creating an EGL surface on a QPixmap is only supported for QX11PlatformPixmap"); return EGL_NO_SURFACE; } } else if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) { @@ -426,11 +426,11 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg return surf; } - if (x11PixmapData) { + if (x11PlatformPixmap) { // X11 Pixmaps are only created with a depth, so that's all we need to check EGLint configDepth; eglGetConfigAttrib(QEgl::display(), config, EGL_BUFFER_SIZE , &configDepth); - if (x11PixmapData->depth() != configDepth) { + if (x11PlatformPixmap->depth() != configDepth) { // The bit depths are wrong which means the EGLConfig isn't compatable with // this pixmap. So we need to replace the pixmap's existing data with a new // one which is created with the correct depth: @@ -438,13 +438,13 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg #ifndef QT_NO_XRENDER if (configDepth == 32) { qWarning("Warning: EGLConfig's depth (32) != pixmap's depth (%d), converting to ARGB32", - x11PixmapData->depth()); - x11PixmapData->convertToARGB32(true); + x11PlatformPixmap->depth()); + x11PlatformPixmap->convertToARGB32(true); } else #endif { qWarning("Warning: EGLConfig's depth (%d) != pixmap's depth (%d)", - configDepth, x11PixmapData->depth()); + configDepth, x11PlatformPixmap->depth()); } } @@ -458,10 +458,10 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg surfaceAttribs.setValue(EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB); EGLSurface surf = eglCreatePixmapSurface(QEgl::display(), config, - (EGLNativePixmapType) x11PixmapData->handle(), + (EGLNativePixmapType) x11PlatformPixmap->handle(), surfaceAttribs.properties()); - x11PixmapData->gl_surface = (void*)surf; - QImagePixmapCleanupHooks::enableCleanupHooks(x11PixmapData); + x11PlatformPixmap->gl_surface = (void*)surf; + QImagePixmapCleanupHooks::enableCleanupHooks(x11PlatformPixmap); return surf; } diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h index 6cd76b386c..16da430130 100644 --- a/src/gui/egl/qeglcontext_p.h +++ b/src/gui/egl/qeglcontext_p.h @@ -109,7 +109,7 @@ private: static void setCurrentContext(QEgl::API api, QEglContext *context); friend class QMeeGoGraphicsSystem; - friend class QMeeGoPixmapData; + friend class QMeeGoPlatformPixmap; }; QT_END_NAMESPACE diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 27aac41ebe..a2bf90ce39 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -21,8 +21,7 @@ HEADERS += \ image/qpixmap_blitter_p.h \ image/qpixmapcache.h \ image/qpixmapcache_p.h \ - image/qpixmapdata_p.h \ - image/qpixmapdatafactory_p.h \ + image/qplatformpixmap_qpa.h \ image/qimagepixmapcleanuphooks_p.h \ image/qvolatileimage_p.h \ image/qvolatileimagedata_p.h \ @@ -39,8 +38,7 @@ SOURCES += \ image/qpictureformatplugin.cpp \ image/qpixmap.cpp \ image/qpixmapcache.cpp \ - image/qpixmapdata.cpp \ - image/qpixmapdatafactory.cpp \ + image/qplatformpixmap.cpp \ image/qmovie.cpp \ image/qpixmap_raster.cpp \ image/qpixmap_blitter.cpp \ diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index 59b8bb037e..c614ba1b0a 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qbitmap.h" -#include "qpixmapdata_p.h" +#include "qplatformpixmap_qpa.h" #include "qimage.h" #include "qvariant.h" #include @@ -101,7 +101,7 @@ QT_BEGIN_NAMESPACE \sa QPixmap::isNull() */ QBitmap::QBitmap() - : QPixmap(QSize(0, 0), QPixmapData::BitmapType) + : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType) { } @@ -115,7 +115,7 @@ QBitmap::QBitmap() */ QBitmap::QBitmap(int w, int h) - : QPixmap(QSize(w, h), QPixmapData::BitmapType) + : QPixmap(QSize(w, h), QPlatformPixmap::BitmapType) { } @@ -127,7 +127,7 @@ QBitmap::QBitmap(int w, int h) */ QBitmap::QBitmap(const QSize &size) - : QPixmap(size, QPixmapData::BitmapType) + : QPixmap(size, QPlatformPixmap::BitmapType) { } @@ -172,7 +172,7 @@ QBitmap::QBitmap(const QPixmap &pixmap) */ QBitmap::QBitmap(const QString& fileName, const char *format) - : QPixmap(QSize(0, 0), QPixmapData::BitmapType) + : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType) { load(fileName, format, Qt::MonoOnly); } @@ -260,7 +260,7 @@ QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) img.setColor(1, c0); } - QScopedPointer data(QGuiApplicationPrivate::platformIntegration()->createPixmapData(QPixmapData::BitmapType)); + QScopedPointer data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::BitmapType)); data->fromImage(img, flags | Qt::MonoOnly); return QPixmap(data.take()); diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h index f58e6b5c46..a3104f5083 100644 --- a/src/gui/image/qbitmap.h +++ b/src/gui/image/qbitmap.h @@ -75,7 +75,7 @@ public: QBitmap transformed(const QMatrix &) const; QBitmap transformed(const QTransform &matrix) const; - typedef QExplicitlySharedDataPointer DataPtr; + typedef QExplicitlySharedDataPointer DataPtr; }; Q_DECLARE_SHARED(QBitmap) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 3e251ba705..2dbb2f4b52 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -54,9 +54,9 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index c5168faaa3..7e8a0a28e8 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -288,8 +288,8 @@ private: friend class QWSOnScreenSurface; QImageData *d; - friend class QRasterPixmapData; - friend class QBlittablePixmapData; + friend class QRasterPlatformPixmap; + friend class QBlittablePlatformPixmap; friend class QPixmapCacheEntry; friend Q_GUI_EXPORT qint64 qt_image_id(const QImage &image); friend const QVector *qt_image_colortable(const QImage &image); diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index aa1bf8059e..7901045593 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qimagepixmapcleanuphooks_p.h" -#include "private/qpixmapdata_p.h" +#include "qplatformpixmap_qpa.h" #include "private/qimage_p.h" @@ -62,12 +62,12 @@ QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance() return qt_image_and_pixmap_cleanup_hooks(); } -void QImagePixmapCleanupHooks::addPixmapDataModificationHook(_qt_pixmap_cleanup_hook_pmd hook) +void QImagePixmapCleanupHooks::addPlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd hook) { pixmapModificationHooks.append(hook); } -void QImagePixmapCleanupHooks::addPixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) +void QImagePixmapCleanupHooks::addPlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) { pixmapDestructionHooks.append(hook); } @@ -78,12 +78,12 @@ void QImagePixmapCleanupHooks::addImageHook(_qt_image_cleanup_hook_64 hook) imageHooks.append(hook); } -void QImagePixmapCleanupHooks::removePixmapDataModificationHook(_qt_pixmap_cleanup_hook_pmd hook) +void QImagePixmapCleanupHooks::removePlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd hook) { pixmapModificationHooks.removeAll(hook); } -void QImagePixmapCleanupHooks::removePixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) +void QImagePixmapCleanupHooks::removePlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) { pixmapDestructionHooks.removeAll(hook); } @@ -93,7 +93,7 @@ void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook) imageHooks.removeAll(hook); } -void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* pmd) +void QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(QPlatformPixmap* pmd) { QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); // the global destructor for the pixmap and image hooks might have @@ -108,7 +108,7 @@ void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* p qt_pixmap_cleanup_hook_64(pmd->cacheKey()); } -void QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(QPixmapData* pmd) +void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPixmap* pmd) { QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); // the global destructor for the pixmap and image hooks might have @@ -133,9 +133,9 @@ void QImagePixmapCleanupHooks::executeImageHooks(qint64 key) } -void QImagePixmapCleanupHooks::enableCleanupHooks(QPixmapData *pixmapData) +void QImagePixmapCleanupHooks::enableCleanupHooks(QPlatformPixmap *handle) { - pixmapData->is_cached = true; + handle->is_cached = true; } void QImagePixmapCleanupHooks::enableCleanupHooks(const QPixmap &pixmap) diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h index fe49ea0c5e..c98da6110a 100644 --- a/src/gui/image/qimagepixmapcleanuphooks_p.h +++ b/src/gui/image/qimagepixmapcleanuphooks_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE typedef void (*_qt_image_cleanup_hook_64)(qint64); -typedef void (*_qt_pixmap_cleanup_hook_pmd)(QPixmapData*); +typedef void (*_qt_pixmap_cleanup_hook_pmd)(QPlatformPixmap*); class QImagePixmapCleanupHooks; @@ -70,26 +70,26 @@ public: static void enableCleanupHooks(const QImage &image); static void enableCleanupHooks(const QPixmap &pixmap); - static void enableCleanupHooks(QPixmapData *pixmapData); + static void enableCleanupHooks(QPlatformPixmap *handle); static bool isImageCached(const QImage &image); static bool isPixmapCached(const QPixmap &pixmap); // Gets called when a pixmap data is about to be modified: - void addPixmapDataModificationHook(_qt_pixmap_cleanup_hook_pmd); + void addPlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd); // Gets called when a pixmap data is about to be destroyed: - void addPixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd); + void addPlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd); // Gets called when an image is about to be modified or destroyed: void addImageHook(_qt_image_cleanup_hook_64); - void removePixmapDataModificationHook(_qt_pixmap_cleanup_hook_pmd); - void removePixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd); + void removePlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd); + void removePlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd); void removeImageHook(_qt_image_cleanup_hook_64); - static void executePixmapDataModificationHooks(QPixmapData*); - static void executePixmapDataDestructionHooks(QPixmapData*); + static void executePlatformPixmapModificationHooks(QPlatformPixmap*); + static void executePlatformPixmapDestructionHooks(QPlatformPixmap*); static void executeImageHooks(qint64 key); private: diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 97577241ee..af27baea0e 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -42,7 +42,7 @@ #include #include "qpixmap.h" -#include "qpixmapdata_p.h" +#include "qplatformpixmap_qpa.h" #include "qimagepixmapcleanuphooks_p.h" #include "qbitmap.h" @@ -95,8 +95,8 @@ static bool qt_pixmap_thread_test() void QPixmap::init(int w, int h, int type) { - if ((w > 0 && h > 0) || type == QPixmapData::BitmapType) - data = QPixmapData::create(w, h, (QPixmapData::PixelType) type); + if ((w > 0 && h > 0) || type == QPlatformPixmap::BitmapType) + data = QPlatformPixmap::create(w, h, (QPlatformPixmap::PixelType) type); else data = 0; } @@ -127,7 +127,7 @@ QPixmap::QPixmap() : QPaintDevice() { (void) qt_pixmap_thread_test(); - init(0, 0, QPixmapData::PixmapType); + init(0, 0, QPlatformPixmap::PixmapType); } /*! @@ -148,9 +148,9 @@ QPixmap::QPixmap(int w, int h) : QPaintDevice() { if (!qt_pixmap_thread_test()) - init(0, 0, QPixmapData::PixmapType); + init(0, 0, QPlatformPixmap::PixmapType); else - init(w, h, QPixmapData::PixmapType); + init(w, h, QPlatformPixmap::PixmapType); } /*! @@ -167,9 +167,9 @@ QPixmap::QPixmap(const QSize &size) : QPaintDevice() { if (!qt_pixmap_thread_test()) - init(0, 0, QPixmapData::PixmapType); + init(0, 0, QPlatformPixmap::PixmapType); else - init(size.width(), size.height(), QPixmapData::PixmapType); + init(size.width(), size.height(), QPlatformPixmap::PixmapType); } /*! @@ -178,15 +178,15 @@ QPixmap::QPixmap(const QSize &size) QPixmap::QPixmap(const QSize &s, int type) { if (!qt_pixmap_thread_test()) - init(0, 0, static_cast(type)); + init(0, 0, static_cast(type)); else - init(s.width(), s.height(), static_cast(type)); + init(s.width(), s.height(), static_cast(type)); } /*! \internal */ -QPixmap::QPixmap(QPixmapData *d) +QPixmap::QPixmap(QPlatformPixmap *d) : QPaintDevice(), data(d) { } @@ -223,7 +223,7 @@ QPixmap::QPixmap(QPixmapData *d) QPixmap::QPixmap(const QString& fileName, const char *format, Qt::ImageConversionFlags flags) : QPaintDevice() { - init(0, 0, QPixmapData::PixmapType); + init(0, 0, QPlatformPixmap::PixmapType); if (!qt_pixmap_thread_test()) return; @@ -240,7 +240,7 @@ QPixmap::QPixmap(const QPixmap &pixmap) : QPaintDevice() { if (!qt_pixmap_thread_test()) { - init(0, 0, QPixmapData::PixmapType); + init(0, 0, QPlatformPixmap::PixmapType); return; } if (pixmap.paintingActive()) { // make a deep copy @@ -269,13 +269,13 @@ QPixmap::QPixmap(const QPixmap &pixmap) QPixmap::QPixmap(const char * const xpm[]) : QPaintDevice() { - init(0, 0, QPixmapData::PixmapType); + init(0, 0, QPlatformPixmap::PixmapType); if (!xpm) return; QImage image(xpm); if (!image.isNull()) { - if (data && data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPlatformPixmap::BitmapType) *this = QBitmap::fromImage(image); else *this = fromImage(image); @@ -330,7 +330,7 @@ QPixmap QPixmap::copy(const QRect &rect) const if (!rect.isEmpty()) r = r.intersected(rect); - QPixmapData *d = data->createCompatiblePixmapData(); + QPlatformPixmap *d = data->createCompatiblePlatformPixmap(); d->copy(data.data(), r); return QPixmap(d); } @@ -507,7 +507,7 @@ QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h) bool QPixmap::isQBitmap() const { - return data->type == QPixmapData::BitmapType; + return data->type == QPlatformPixmap::BitmapType; } /*! @@ -782,7 +782,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers % info.absoluteFilePath() % HexString(info.lastModified().toTime_t()) % HexString(info.size()) - % HexString(data ? data->pixelType() : QPixmapData::PixmapType); + % HexString(data ? data->pixelType() : QPlatformPixmap::PixmapType); // Note: If no extension is provided, we try to match the // file against known plugin extensions @@ -792,7 +792,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers if (QPixmapCache::find(key, *this)) return true; - QScopedPointer tmp(QPixmapData::create(0, 0, data ? data->type : QPixmapData::PixmapType)); + QScopedPointer tmp(QPlatformPixmap::create(0, 0, data ? data->type : QPlatformPixmap::PixmapType)); if (tmp->fromFile(fileName, format, flags)) { data = tmp.take(); QPixmapCache::insert(key, *this); @@ -827,7 +827,7 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I return false; if (!data) - data = QPixmapData::create(0, 0, QPixmapData::PixmapType); + data = QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType); return data->fromData(buf, len, format, flags); } @@ -941,7 +941,7 @@ void QPixmap::fill(const QColor &color) } else { // Don't bother to make a copy of the data object, since // it will be filled with new pixel data anyway. - QPixmapData *d = data->createCompatiblePixmapData(); + QPlatformPixmap *d = data->createCompatiblePlatformPixmap(); d->resize(data->width(), data->height()); data = d; } @@ -1704,17 +1704,17 @@ void QPixmap::detach() if (!data) return; - // QPixmap.data member may be QRuntimePixmapData so use pixmapData() function to get + // QPixmap.data member may be QRuntimePlatformPixmap so use handle() function to get // the actual underlaying runtime pixmap data. - QPixmapData *pd = pixmapData(); - QPixmapData::ClassId id = pd->classId(); - if (id == QPixmapData::RasterClass) { - QRasterPixmapData *rasterData = static_cast(pd); + QPlatformPixmap *pd = handle(); + QPlatformPixmap::ClassId id = pd->classId(); + if (id == QPlatformPixmap::RasterClass) { + QRasterPlatformPixmap *rasterData = static_cast(pd); rasterData->image.detach(); } if (data->is_cached && data->ref == 1) - QImagePixmapCleanupHooks::executePixmapDataModificationHooks(data.data()); + QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(data.data()); if (data->ref != 1) { *this = copy(); @@ -1742,7 +1742,7 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) if (image.isNull()) return QPixmap(); - QScopedPointer data(QGuiApplicationPrivate::platformIntegration()->createPixmapData(QPixmapData::PixmapType)); + QScopedPointer data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType)); data->fromImage(image, flags); return QPixmap(data.take()); } @@ -1761,7 +1761,7 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) */ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) { - QScopedPointer data(QGuiApplicationPrivate::platformIntegration()->createPixmapData(QPixmapData::PixmapType)); + QScopedPointer data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType)); data->fromImageReader(imageReader, flags); return QPixmap(data.take()); } @@ -1810,7 +1810,7 @@ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionF /*! \internal */ -QPixmapData* QPixmap::pixmapData() const +QPlatformPixmap* QPixmap::handle() const { return data.data(); } diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 084e5d5d33..642556e71b 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -61,13 +61,13 @@ class QImageReader; class QColor; class QVariant; class QX11Info; -class QPixmapData; +class QPlatformPixmap; class Q_GUI_EXPORT QPixmap : public QPaintDevice { public: QPixmap(); - explicit QPixmap(QPixmapData *data); + explicit QPixmap(QPlatformPixmap *data); QPixmap(int w, int h); QPixmap(const QSize &); QPixmap(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); @@ -168,7 +168,7 @@ protected: int metric(PaintDeviceMetric) const; private: - QExplicitlySharedDataPointer data; + QExplicitlySharedDataPointer data; bool doImageIO(QImageWriter *io, int quality) const; @@ -176,7 +176,7 @@ private: void init(int, int, int); void deref(); Q_DUMMY_COMPARISON_OPERATOR(QPixmap) - friend class QPixmapData; + friend class QPlatformPixmap; friend class QBitmap; friend class QPaintDevice; friend class QPainter; @@ -188,10 +188,10 @@ private: #endif public: - QPixmapData* pixmapData() const; + QPlatformPixmap* handle() const; public: - typedef QExplicitlySharedDataPointer DataPtr; + typedef QExplicitlySharedDataPointer DataPtr; inline DataPtr &data_ptr() { return data; } }; diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 465bc40e4c..43876419d4 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -55,8 +55,8 @@ QT_BEGIN_NAMESPACE static int global_ser_no = 0; -QBlittablePixmapData::QBlittablePixmapData() - : QPixmapData(QPixmapData::PixmapType,BlitterClass), m_engine(0), m_blittable(0) +QBlittablePlatformPixmap::QBlittablePlatformPixmap() + : QPlatformPixmap(QPlatformPixmap::PixmapType,BlitterClass), m_engine(0), m_blittable(0) #ifdef QT_BLITTER_RASTEROVERLAY ,m_rasterOverlay(0), m_unmergedCopy(0) #endif //QT_BLITTER_RASTEROVERLAY @@ -64,7 +64,7 @@ QBlittablePixmapData::QBlittablePixmapData() setSerialNumber(++global_ser_no); } -QBlittablePixmapData::~QBlittablePixmapData() +QBlittablePlatformPixmap::~QBlittablePlatformPixmap() { delete m_blittable; delete m_engine; @@ -74,23 +74,23 @@ QBlittablePixmapData::~QBlittablePixmapData() #endif //QT_BLITTER_RASTEROVERLAY } -QBlittable *QBlittablePixmapData::blittable() const +QBlittable *QBlittablePlatformPixmap::blittable() const { if (!m_blittable) { - QBlittablePixmapData *that = const_cast(this); + QBlittablePlatformPixmap *that = const_cast(this); that->m_blittable = this->createBlittable(QSize(w,h)); } return m_blittable; } -void QBlittablePixmapData::setBlittable(QBlittable *blittable) +void QBlittablePlatformPixmap::setBlittable(QBlittable *blittable) { resize(blittable->size().width(),blittable->size().height()); m_blittable = blittable; } -void QBlittablePixmapData::resize(int width, int height) +void QBlittablePlatformPixmap::resize(int width, int height) { delete m_blittable; @@ -105,7 +105,7 @@ void QBlittablePixmapData::resize(int width, int height) is_null = (w <= 0 || h <= 0); } -int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const { switch (metric) { case QPaintDevice::PdmWidth: @@ -125,14 +125,14 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmPhysicalDpiY: return qt_defaultDpiY(); default: - qWarning("QRasterPixmapData::metric(): Unhandled metric type %d", metric); + qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric); break; } return 0; } -void QBlittablePixmapData::fill(const QColor &color) +void QBlittablePlatformPixmap::fill(const QColor &color) { //jlind: todo: change when blittables can support non opaque fillRects if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) { @@ -166,22 +166,22 @@ void QBlittablePixmapData::fill(const QColor &color) } -QImage *QBlittablePixmapData::buffer() +QImage *QBlittablePlatformPixmap::buffer() { return blittable()->lock(); } -QImage QBlittablePixmapData::toImage() const +QImage QBlittablePlatformPixmap::toImage() const { return blittable()->lock()->copy(); } -bool QBlittablePixmapData::hasAlphaChannel() const +bool QBlittablePlatformPixmap::hasAlphaChannel() const { return blittable()->lock()->hasAlphaChannel(); } -void QBlittablePixmapData::fromImage(const QImage &image, +void QBlittablePlatformPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) { resize(image.width(),image.height()); @@ -203,10 +203,10 @@ void QBlittablePixmapData::fromImage(const QImage &image, } } -QPaintEngine *QBlittablePixmapData::paintEngine() const +QPaintEngine *QBlittablePlatformPixmap::paintEngine() const { if (!m_engine) { - QBlittablePixmapData *that = const_cast(this); + QBlittablePlatformPixmap *that = const_cast(this); that->m_engine = new QBlitterPaintEngine(that); } return m_engine; @@ -216,7 +216,7 @@ QPaintEngine *QBlittablePixmapData::paintEngine() const static bool showRasterOverlay = !qgetenv("QT_BLITTER_RASTEROVERLAY").isEmpty(); -void QBlittablePixmapData::mergeOverlay() +void QBlittablePlatformPixmap::mergeOverlay() { if (m_unmergedCopy || !showRasterOverlay) return; @@ -227,7 +227,7 @@ void QBlittablePixmapData::mergeOverlay() p.end(); } -void QBlittablePixmapData::unmergeOverlay() +void QBlittablePlatformPixmap::unmergeOverlay() { if (!m_unmergedCopy || !showRasterOverlay) return; @@ -240,7 +240,7 @@ void QBlittablePixmapData::unmergeOverlay() m_unmergedCopy = 0; } -QImage *QBlittablePixmapData::overlay() +QImage *QBlittablePlatformPixmap::overlay() { if (!m_rasterOverlay|| m_rasterOverlay->size() != QSize(w,h)){ @@ -254,7 +254,7 @@ QImage *QBlittablePixmapData::overlay() return m_rasterOverlay; } -void QBlittablePixmapData::markRasterOverlayImpl(const QRectF &rect) +void QBlittablePlatformPixmap::markRasterOverlayImpl(const QRectF &rect) { if (!showRasterOverlay) return; @@ -267,7 +267,7 @@ void QBlittablePixmapData::markRasterOverlayImpl(const QRectF &rect) } } -void QBlittablePixmapData::unmarkRasterOverlayImpl(const QRectF &rect) +void QBlittablePlatformPixmap::unmarkRasterOverlayImpl(const QRectF &rect) { if (!showRasterOverlay) return; @@ -281,7 +281,7 @@ void QBlittablePixmapData::unmarkRasterOverlayImpl(const QRectF &rect) } } -QRectF QBlittablePixmapData::clipAndTransformRect(const QRectF &rect) const +QRectF QBlittablePlatformPixmap::clipAndTransformRect(const QRectF &rect) const { QRectF transformationRect = rect; paintEngine(); diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 07791e548b..3ab5cb3da3 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -42,18 +42,18 @@ #ifndef QPIXMAP_BLITTER_P_H #define QPIXMAP_BLITTER_P_H -#include +#include #include #ifndef QT_NO_BLITTABLE QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData +class Q_GUI_EXPORT QBlittablePlatformPixmap : public QPlatformPixmap { -// Q_DECLARE_PRIVATE(QBlittablePixmapData); +// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap); public: - QBlittablePixmapData(); - ~QBlittablePixmapData(); + QBlittablePlatformPixmap(); + ~QBlittablePlatformPixmap(); virtual QBlittable *createBlittable(const QSize &size) const = 0; QBlittable *blittable() const; @@ -98,7 +98,7 @@ protected: }; -inline void QBlittablePixmapData::markRasterOverlay(const QRectF &rect) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF &rect) { #ifdef QT_BLITTER_RASTEROVERLAY markRasterOverlayImpl(rect); @@ -107,7 +107,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QRectF &rect) #endif } -inline void QBlittablePixmapData::markRasterOverlay(const QVectorPath &path) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QVectorPath &path) { #ifdef QT_BLITTER_RASTEROVERLAY markRasterOverlayImpl(path.convertToPainterPath().boundingRect()); @@ -116,7 +116,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QVectorPath &path) #endif } -inline void QBlittablePixmapData::markRasterOverlay(const QPointF &pos, const QTextItem &ti) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QPointF &pos, const QTextItem &ti) { #ifdef QT_BLITTER_RASTEROVERLAY QFontMetricsF fm(ti.font()); @@ -129,7 +129,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QPointF &pos, const QT #endif } -inline void QBlittablePixmapData::markRasterOverlay(const QRect *rects, int rectCount) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QRect *rects, int rectCount) { #ifdef QT_BLITTER_RASTEROVERLAY for (int i = 0; i < rectCount; i++) { @@ -140,7 +140,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QRect *rects, int rect Q_UNUSED(rectCount) #endif } -inline void QBlittablePixmapData::markRasterOverlay(const QRectF *rects, int rectCount) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF *rects, int rectCount) { #ifdef QT_BLITTER_RASTEROVERLAY for (int i = 0; i < rectCount; i++) { @@ -152,7 +152,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QRectF *rects, int rec #endif } -inline void QBlittablePixmapData::unmarkRasterOverlay(const QRectF &rect) +inline void QBlittablePlatformPixmap::unmarkRasterOverlay(const QRectF &rect) { #ifdef QT_BLITTER_RASTEROVERLAY unmarkRasterOverlayImpl(rect); diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index a0ae88dc70..ce7d66043c 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -60,10 +60,10 @@ QT_BEGIN_NAMESPACE QPixmap qt_toRasterPixmap(const QImage &image) { - QPixmapData *data = - new QRasterPixmapData(image.depth() == 1 - ? QPixmapData::BitmapType - : QPixmapData::PixmapType); + QPlatformPixmap *data = + new QRasterPlatformPixmap(image.depth() == 1 + ? QPlatformPixmap::BitmapType + : QPlatformPixmap::PixmapType); data->fromImage(image, Qt::AutoColor); @@ -75,27 +75,27 @@ QPixmap qt_toRasterPixmap(const QPixmap &pixmap) if (pixmap.isNull()) return QPixmap(); - if (QPixmap(pixmap).data_ptr()->classId() == QPixmapData::RasterClass) + if (QPixmap(pixmap).data_ptr()->classId() == QPlatformPixmap::RasterClass) return pixmap; return qt_toRasterPixmap(pixmap.toImage()); } -QRasterPixmapData::QRasterPixmapData(PixelType type) - : QPixmapData(type, RasterClass) +QRasterPlatformPixmap::QRasterPlatformPixmap(PixelType type) + : QPlatformPixmap(type, RasterClass) { } -QRasterPixmapData::~QRasterPixmapData() +QRasterPlatformPixmap::~QRasterPlatformPixmap() { } -QPixmapData *QRasterPixmapData::createCompatiblePixmapData() const +QPlatformPixmap *QRasterPlatformPixmap::createCompatiblePlatformPixmap() const { - return new QRasterPixmapData(pixelType()); + return new QRasterPlatformPixmap(pixelType()); } -void QRasterPixmapData::resize(int width, int height) +void QRasterPlatformPixmap::resize(int width, int height) { QImage::Format format; #ifdef Q_WS_QWS @@ -130,7 +130,7 @@ void QRasterPixmapData::resize(int width, int height) setSerialNumber(image.serialNumber()); } -bool QRasterPixmapData::fromData(const uchar *buffer, uint len, const char *format, +bool QRasterPlatformPixmap::fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags) { QByteArray a = QByteArray::fromRawData(reinterpret_cast(buffer), len); @@ -144,7 +144,7 @@ bool QRasterPixmapData::fromData(const uchar *buffer, uint len, const char *form return !isNull(); } -void QRasterPixmapData::fromImage(const QImage &sourceImage, +void QRasterPlatformPixmap::fromImage(const QImage &sourceImage, Qt::ImageConversionFlags flags) { Q_UNUSED(flags); @@ -152,7 +152,7 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, createPixmapForImage(image, flags, /* inplace = */false); } -void QRasterPixmapData::fromImageReader(QImageReader *imageReader, +void QRasterPlatformPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) { Q_UNUSED(flags); @@ -166,19 +166,19 @@ void QRasterPixmapData::fromImageReader(QImageReader *imageReader, // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); -void QRasterPixmapData::copy(const QPixmapData *data, const QRect &rect) +void QRasterPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) { fromImage(data->toImage(rect).copy(), Qt::NoOpaqueDetection); } -bool QRasterPixmapData::scroll(int dx, int dy, const QRect &rect) +bool QRasterPlatformPixmap::scroll(int dx, int dy, const QRect &rect) { if (!image.isNull()) qt_scrollRectInImage(image, rect, QPoint(dx, dy)); return true; } -void QRasterPixmapData::fill(const QColor &color) +void QRasterPlatformPixmap::fill(const QColor &color) { uint pixel; @@ -262,12 +262,12 @@ void QRasterPixmapData::fill(const QColor &color) image.fill(pixel); } -bool QRasterPixmapData::hasAlphaChannel() const +bool QRasterPlatformPixmap::hasAlphaChannel() const { return image.hasAlphaChannel(); } -QImage QRasterPixmapData::toImage() const +QImage QRasterPlatformPixmap::toImage() const { if (!image.isNull()) { QImageData *data = const_cast(image).data_ptr(); @@ -281,7 +281,7 @@ QImage QRasterPixmapData::toImage() const return image; } -QImage QRasterPixmapData::toImage(const QRect &rect) const +QImage QRasterPlatformPixmap::toImage(const QRect &rect) const { if (rect.isNull()) return image; @@ -295,12 +295,12 @@ QImage QRasterPixmapData::toImage(const QRect &rect) const return image.copy(clipped); } -QPaintEngine* QRasterPixmapData::paintEngine() const +QPaintEngine* QRasterPlatformPixmap::paintEngine() const { return image.paintEngine(); } -int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +int QRasterPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const { QImageData *d = image.d; if (!d) @@ -327,14 +327,14 @@ int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmPhysicalDpiY: return qt_defaultDpiY(); default: - qWarning("QRasterPixmapData::metric(): Unhandled metric type %d", metric); + qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric); break; } return 0; } -void QRasterPixmapData::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace) +void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace) { QImage::Format format; if (flags & Qt::NoFormatConversion) @@ -436,7 +436,7 @@ void QRasterPixmapData::createPixmapForImage(QImage &sourceImage, Qt::ImageConve setSerialNumber(image.serialNumber()); } -QImage* QRasterPixmapData::buffer() +QImage* QRasterPlatformPixmap::buffer() { return ℑ } diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index e8d1b39b17..c451a94858 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -53,8 +53,7 @@ // We mean it. // -#include -#include +#include #ifdef Q_WS_WIN # include "qt_windows.h" @@ -62,13 +61,13 @@ QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QRasterPixmapData : public QPixmapData +class Q_GUI_EXPORT QRasterPlatformPixmap : public QPlatformPixmap { public: - QRasterPixmapData(PixelType type); - ~QRasterPixmapData(); + QRasterPlatformPixmap(PixelType type); + ~QRasterPlatformPixmap(); - QPixmapData *createCompatiblePixmapData() const; + QPlatformPixmap *createCompatiblePlatformPixmap() const; void resize(int width, int height); void fromFile(const QString &filename, Qt::ImageConversionFlags flags); @@ -76,7 +75,7 @@ public: void fromImage(const QImage &image, Qt::ImageConversionFlags flags); void fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags); - void copy(const QPixmapData *data, const QRect &rect); + void copy(const QPlatformPixmap *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); void fill(const QColor &color); bool hasAlphaChannel() const; diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h index 336c0f01d4..7b96f5a2cf 100644 --- a/src/gui/image/qpixmapcache_p.h +++ b/src/gui/image/qpixmapcache_p.h @@ -81,9 +81,9 @@ class QPixmapCacheEntry : public QPixmap public: QPixmapCacheEntry(const QPixmapCache::Key &key, const QPixmap &pix) : QPixmap(pix), key(key) { - QPixmapData *pd = pixmapData(); - if (pd && pd->classId() == QPixmapData::RasterClass) { - QRasterPixmapData *d = static_cast(pd); + QPlatformPixmap *pd = handle(); + if (pd && pd->classId() == QPlatformPixmap::RasterClass) { + QRasterPlatformPixmap *d = static_cast(pd); if (!d->image.isNull() && d->image.d->paintEngine && !d->image.d->paintEngine->isActive()) { diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp deleted file mode 100644 index e63e7aae0f..0000000000 --- a/src/gui/image/qpixmapdata.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpixmapdata_p.h" -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QPixmapData *QPixmapData::create(int w, int h, PixelType type) -{ - QPixmapData *data = QGuiApplicationPrivate::platformIntegration()->createPixmapData(static_cast(type)); - data->resize(w, h); - return data; -} - - -QPixmapData::QPixmapData(PixelType pixelType, int objectId) - : w(0), - h(0), - d(0), - is_null(true), - ref(0), - detach_no(0), - type(pixelType), - id(objectId), - ser_no(0), - is_cached(false) -{ -} - -QPixmapData::~QPixmapData() -{ - // Sometimes the pixmap cleanup hooks will be called from derrived classes, which will - // then set is_cached to false. For example, on X11 QtOpenGL needs to delete the GLXPixmap - // or EGL Pixmap Surface for a given pixmap _before_ the native X11 pixmap is deleted, - // otherwise some drivers will leak the GL surface. In this case, QX11PixmapData will - // call the cleanup hooks itself before deleting the native pixmap and set is_cached to - // false. - if (is_cached) { - QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(this); - is_cached = false; - } -} - -QPixmapData *QPixmapData::createCompatiblePixmapData() const -{ - QPixmapData *d = QGuiApplicationPrivate::platformIntegration()->createPixmapData(pixelType()); - return d; -} - -static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Qt::ImageConversionFlags flags) -{ - if (d->pixelType() == QPixmapData::BitmapType) { - QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags); - - // make sure image.color(0) == Qt::color0 (white) - // and image.color(1) == Qt::color1 (black) - const QRgb c0 = QColor(Qt::black).rgb(); - const QRgb c1 = QColor(Qt::white).rgb(); - if (img.color(0) == c0 && img.color(1) == c1) { - img.invertPixels(); - img.setColor(0, c1); - img.setColor(1, c0); - } - return img; - } - - return image; -} - -void QPixmapData::fromImageReader(QImageReader *imageReader, - Qt::ImageConversionFlags flags) -{ - const QImage image = imageReader->read(); - fromImage(image, flags); -} - -bool QPixmapData::fromFile(const QString &fileName, const char *format, - Qt::ImageConversionFlags flags) -{ - QImage image = QImageReader(fileName, format).read(); - if (image.isNull()) - return false; - fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); - return !isNull(); -} - -bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) -{ - QByteArray a = QByteArray::fromRawData(reinterpret_cast(buf), len); - QBuffer b(&a); - b.open(QIODevice::ReadOnly); - QImage image = QImageReader(&b, format).read(); - fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); - return !isNull(); -} - -void QPixmapData::copy(const QPixmapData *data, const QRect &rect) -{ - fromImage(data->toImage(rect), Qt::NoOpaqueDetection); -} - -bool QPixmapData::scroll(int dx, int dy, const QRect &rect) -{ - Q_UNUSED(dx); - Q_UNUSED(dy); - Q_UNUSED(rect); - return false; -} - -QPixmap QPixmapData::transformed(const QTransform &matrix, - Qt::TransformationMode mode) const -{ - return QPixmap::fromImage(toImage().transformed(matrix, mode)); -} - -void QPixmapData::setSerialNumber(int serNo) -{ - ser_no = serNo; -} - -QImage QPixmapData::toImage(const QRect &rect) const -{ - if (rect.contains(QRect(0, 0, w, h))) - return toImage(); - else - return toImage().copy(rect); -} - -QImage* QPixmapData::buffer() -{ - return 0; -} - -#if defined(Q_OS_SYMBIAN) -void* QPixmapData::toNativeType(NativeType /* type */) -{ - return 0; -} - -void QPixmapData::fromNativeType(void* /* pixmap */, NativeType /* typre */) -{ - return; -} -#endif - -QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h deleted file mode 100644 index ea3e03b382..0000000000 --- a/src/gui/image/qpixmapdata_p.h +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPIXMAPDATA_P_H -#define QPIXMAPDATA_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -class QImageReader; - -class Q_GUI_EXPORT QPixmapData -{ -public: - enum PixelType { - // WARNING: Do not change the first two - // Must match QPixmap::Type - PixmapType, BitmapType - }; - - enum ClassId { RasterClass, DirectFBClass, - BlitterClass, CustomClass = 1024 }; - - QPixmapData(PixelType pixelType, int classId); - virtual ~QPixmapData(); - - virtual QPixmapData *createCompatiblePixmapData() const; - - virtual void resize(int width, int height) = 0; - virtual void fromImage(const QImage &image, - Qt::ImageConversionFlags flags) = 0; - virtual void fromImageReader(QImageReader *imageReader, - Qt::ImageConversionFlags flags); - - virtual bool fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags); - virtual bool fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags); - - virtual void copy(const QPixmapData *data, const QRect &rect); - virtual bool scroll(int dx, int dy, const QRect &rect); - - virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0; - virtual void fill(const QColor &color) = 0; - - virtual bool hasAlphaChannel() const = 0; - virtual QPixmap transformed(const QTransform &matrix, - Qt::TransformationMode mode) const; - - virtual QImage toImage() const = 0; - virtual QImage toImage(const QRect &rect) const; - virtual QPaintEngine* paintEngine() const = 0; - - inline int serialNumber() const { return ser_no; } - - inline PixelType pixelType() const { return type; } - inline ClassId classId() const { return static_cast(id); } - - virtual QImage* buffer(); - - inline int width() const { return w; } - inline int height() const { return h; } - inline int colorCount() const { return metric(QPaintDevice::PdmNumColors); } - inline int depth() const { return d; } - inline bool isNull() const { return is_null; } - inline qint64 cacheKey() const { - int classKey = id; - if (classKey >= 1024) - classKey = -(classKey >> 10); - return ((((qint64) classKey) << 56) - | (((qint64) ser_no) << 32) - | ((qint64) detach_no)); - } - - static QPixmapData *create(int w, int h, PixelType type); - -protected: - - void setSerialNumber(int serNo); - int w; - int h; - int d; - bool is_null; - -private: - friend class QPixmap; - friend class QImagePixmapCleanupHooks; // Needs to set is_cached - friend class QGLTextureCache; //Needs to check the reference count - friend class QExplicitlySharedDataPointer; - - QAtomicInt ref; - int detach_no; - - PixelType type; - int id; - int ser_no; - uint is_cached; -}; - -# define QT_XFORM_TYPE_MSBFIRST 0 -# define QT_XFORM_TYPE_LSBFIRST 1 -# if defined(Q_WS_WIN) -# define QT_XFORM_TYPE_WINDOWSPIXMAP 2 -# endif -extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int); - -QT_END_NAMESPACE - -#endif // QPIXMAPDATA_P_H diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp deleted file mode 100644 index ceb7a67064..0000000000 --- a/src/gui/image/qpixmapdatafactory.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpixmapdatafactory_p.h" - -#ifdef Q_WS_QWS -# include -#endif -#ifdef Q_WS_X11 -# include -#endif -#if defined(Q_WS_WIN) -# include -#endif -#ifdef Q_WS_MAC -# include -#endif -#ifdef Q_WS_QPA -# include -#endif -#ifdef Q_OS_SYMBIAN -# include -#endif - -#include "private/qguiapplication_p.h" - -QT_BEGIN_NAMESPACE - -#if !defined(Q_WS_QWS) - -class QSimplePixmapDataFactory : public QPixmapDataFactory -{ -public: - ~QSimplePixmapDataFactory() {} - QPixmapData* create(QPixmapData::PixelType type); -}; - -QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type) -{ - // ### should we always use Raster instead? - return QGuiApplicationPrivate::platformIntegration()->createPixmapData(type); -} - -Q_GLOBAL_STATIC(QSimplePixmapDataFactory, factory) - -#endif // !defined(Q_WS_QWS) - -QPixmapDataFactory::~QPixmapDataFactory() -{ -} - -QPixmapDataFactory* QPixmapDataFactory::instance(int screen) -{ - Q_UNUSED(screen); -#ifdef Q_WS_QWS - return QScreen::instance()->pixmapDataFactory(); -#else - return factory(); -#endif -} - -QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapdatafactory_p.h b/src/gui/image/qpixmapdatafactory_p.h deleted file mode 100644 index a539d672c3..0000000000 --- a/src/gui/image/qpixmapdatafactory_p.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPIXMAPDATAFACTORY_P_H -#define QPIXMAPDATAFACTORY_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QPixmapData; - -class QPixmapDataFactory -{ -public: - static QPixmapDataFactory* instance(int screen = 0); - virtual ~QPixmapDataFactory(); - - virtual QPixmapData* create(QPixmapData::PixelType type) = 0; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPIXMAPDATAFACTORY_P_H diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp new file mode 100644 index 0000000000..7fb1bd6530 --- /dev/null +++ b/src/gui/image/qplatformpixmap.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformpixmap_qpa.h" +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QPlatformPixmap *QPlatformPixmap::create(int w, int h, PixelType type) +{ + QPlatformPixmap *data = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(static_cast(type)); + data->resize(w, h); + return data; +} + + +QPlatformPixmap::QPlatformPixmap(PixelType pixelType, int objectId) + : w(0), + h(0), + d(0), + is_null(true), + ref(0), + detach_no(0), + type(pixelType), + id(objectId), + ser_no(0), + is_cached(false) +{ +} + +QPlatformPixmap::~QPlatformPixmap() +{ + // Sometimes the pixmap cleanup hooks will be called from derrived classes, which will + // then set is_cached to false. For example, on X11 QtOpenGL needs to delete the GLXPixmap + // or EGL Pixmap Surface for a given pixmap _before_ the native X11 pixmap is deleted, + // otherwise some drivers will leak the GL surface. In this case, QX11PlatformPixmap will + // call the cleanup hooks itself before deleting the native pixmap and set is_cached to + // false. + if (is_cached) { + QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(this); + is_cached = false; + } +} + +QPlatformPixmap *QPlatformPixmap::createCompatiblePlatformPixmap() const +{ + QPlatformPixmap *d = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(pixelType()); + return d; +} + +static QImage makeBitmapCompliantIfNeeded(QPlatformPixmap *d, const QImage &image, Qt::ImageConversionFlags flags) +{ + if (d->pixelType() == QPlatformPixmap::BitmapType) { + QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags); + + // make sure image.color(0) == Qt::color0 (white) + // and image.color(1) == Qt::color1 (black) + const QRgb c0 = QColor(Qt::black).rgb(); + const QRgb c1 = QColor(Qt::white).rgb(); + if (img.color(0) == c0 && img.color(1) == c1) { + img.invertPixels(); + img.setColor(0, c1); + img.setColor(1, c0); + } + return img; + } + + return image; +} + +void QPlatformPixmap::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + const QImage image = imageReader->read(); + fromImage(image, flags); +} + +bool QPlatformPixmap::fromFile(const QString &fileName, const char *format, + Qt::ImageConversionFlags flags) +{ + QImage image = QImageReader(fileName, format).read(); + if (image.isNull()) + return false; + fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); + return !isNull(); +} + +bool QPlatformPixmap::fromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) +{ + QByteArray a = QByteArray::fromRawData(reinterpret_cast(buf), len); + QBuffer b(&a); + b.open(QIODevice::ReadOnly); + QImage image = QImageReader(&b, format).read(); + fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); + return !isNull(); +} + +void QPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) +{ + fromImage(data->toImage(rect), Qt::NoOpaqueDetection); +} + +bool QPlatformPixmap::scroll(int dx, int dy, const QRect &rect) +{ + Q_UNUSED(dx); + Q_UNUSED(dy); + Q_UNUSED(rect); + return false; +} + +QPixmap QPlatformPixmap::transformed(const QTransform &matrix, + Qt::TransformationMode mode) const +{ + return QPixmap::fromImage(toImage().transformed(matrix, mode)); +} + +void QPlatformPixmap::setSerialNumber(int serNo) +{ + ser_no = serNo; +} + +QImage QPlatformPixmap::toImage(const QRect &rect) const +{ + if (rect.contains(QRect(0, 0, w, h))) + return toImage(); + else + return toImage().copy(rect); +} + +QImage* QPlatformPixmap::buffer() +{ + return 0; +} + +#if defined(Q_OS_SYMBIAN) +void* QPlatformPixmap::toNativeType(NativeType /* type */) +{ + return 0; +} + +void QPlatformPixmap::fromNativeType(void* /* pixmap */, NativeType /* typre */) +{ + return; +} +#endif + +QT_END_NAMESPACE diff --git a/src/gui/image/qplatformpixmap_qpa.h b/src/gui/image/qplatformpixmap_qpa.h new file mode 100644 index 0000000000..5f5b903962 --- /dev/null +++ b/src/gui/image/qplatformpixmap_qpa.h @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPIXMAPDATA_P_H +#define QPIXMAPDATA_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_NAMESPACE + +class QImageReader; + +class Q_GUI_EXPORT QPlatformPixmap +{ +public: + enum PixelType { + // WARNING: Do not change the first two + // Must match QPixmap::Type + PixmapType, BitmapType + }; + + enum ClassId { RasterClass, DirectFBClass, + BlitterClass, CustomClass = 1024 }; + + QPlatformPixmap(PixelType pixelType, int classId); + virtual ~QPlatformPixmap(); + + virtual QPlatformPixmap *createCompatiblePlatformPixmap() const; + + virtual void resize(int width, int height) = 0; + virtual void fromImage(const QImage &image, + Qt::ImageConversionFlags flags) = 0; + virtual void fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags); + + virtual bool fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags); + virtual bool fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags); + + virtual void copy(const QPlatformPixmap *data, const QRect &rect); + virtual bool scroll(int dx, int dy, const QRect &rect); + + virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0; + virtual void fill(const QColor &color) = 0; + + virtual bool hasAlphaChannel() const = 0; + virtual QPixmap transformed(const QTransform &matrix, + Qt::TransformationMode mode) const; + + virtual QImage toImage() const = 0; + virtual QImage toImage(const QRect &rect) const; + virtual QPaintEngine* paintEngine() const = 0; + + inline int serialNumber() const { return ser_no; } + + inline PixelType pixelType() const { return type; } + inline ClassId classId() const { return static_cast(id); } + + virtual QImage* buffer(); + + inline int width() const { return w; } + inline int height() const { return h; } + inline int colorCount() const { return metric(QPaintDevice::PdmNumColors); } + inline int depth() const { return d; } + inline bool isNull() const { return is_null; } + inline qint64 cacheKey() const { + int classKey = id; + if (classKey >= 1024) + classKey = -(classKey >> 10); + return ((((qint64) classKey) << 56) + | (((qint64) ser_no) << 32) + | ((qint64) detach_no)); + } + + static QPlatformPixmap *create(int w, int h, PixelType type); + +protected: + + void setSerialNumber(int serNo); + int w; + int h; + int d; + bool is_null; + +private: + friend class QPixmap; + friend class QImagePixmapCleanupHooks; // Needs to set is_cached + friend class QGLTextureCache; //Needs to check the reference count + friend class QExplicitlySharedDataPointer; + + QAtomicInt ref; + int detach_no; + + PixelType type; + int id; + int ser_no; + uint is_cached; +}; + +# define QT_XFORM_TYPE_MSBFIRST 0 +# define QT_XFORM_TYPE_LSBFIRST 1 +# if defined(Q_WS_WIN) +# define QT_XFORM_TYPE_WINDOWSPIXMAP 2 +# endif +extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int); + +QT_END_NAMESPACE + +#endif // QPIXMAPDATA_P_H diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp index 4f139f844d..f7fe70c496 100644 --- a/src/gui/image/qvolatileimage.cpp +++ b/src/gui/image/qvolatileimage.cpp @@ -42,7 +42,7 @@ #include "qvolatileimage_p.h" #include "qvolatileimagedata_p.h" #include -#include +#include QT_BEGIN_NAMESPACE @@ -236,7 +236,7 @@ void QVolatileImage::copyFrom(QVolatileImage *source, const QRect &rect) } /*! - To be called from the PixmapData's paintEngine(). + To be called from the PlatformPixmap's paintEngine(). */ QPaintEngine *QVolatileImage::paintEngine() { @@ -275,7 +275,7 @@ bool QVolatileImagePaintEngine::end() void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { #ifdef Q_OS_SYMBIAN - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); + void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); if (nativeData) { QVolatileImage *img = static_cast(nativeData); img->beginDataAccess(); @@ -292,7 +292,7 @@ void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) void QVolatileImagePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { #ifdef Q_OS_SYMBIAN - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); + void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); if (nativeData) { QVolatileImage *img = static_cast(nativeData); img->beginDataAccess(); diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index c51924639b..ab0d5100c3 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -142,10 +142,10 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const */ /*! - \fn QPixmapData *QPlatformIntegration::createPixmapData(QPixmapData::PixelType type) const + \fn QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const - Factory function for QPixmapData. PixelType can be either PixmapType or BitmapType. - \sa QPixmapData + Factory function for QPlatformPixmap. PixelType can be either PixmapType or BitmapType. + \sa QPlatformPixmap */ /*! diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index a74ff2916a..092186c160 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -43,7 +43,7 @@ #define QPLATFORMINTEGRATION_H #include -#include +#include #include #include @@ -79,7 +79,7 @@ public: virtual bool hasCapability(Capability cap) const; // GraphicsSystem functions - virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; + virtual QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const = 0; virtual QPlatformWindow *createPlatformWindow(QWindow *window) const = 0; virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const = 0; virtual QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &format, QPlatformGLContext *share) const; diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index 6befdd8ac7..49ceb2a8b3 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -282,7 +282,7 @@ private: friend class QWin32PaintEnginePrivate; friend class QMacCGContext; friend class QPreviewPaintEngine; - friend class QX11GLPixmapData; + friend class QX11GLPlatformPixmap; }; diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index f8bc3f1c9e..0e9a17a183 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -111,7 +111,7 @@ public: bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const { - if (pm.pixmapData()->classId() != QPixmapData::BlitterClass) + if (pm.handle()->classId() != QPlatformPixmap::BlitterClass) return false; if (checkStateAgainstMask(capabillitiesState,drawPixmapMask)) { if (m_capabilities & (QBlittable::SourceOverPixmapCapability @@ -190,7 +190,7 @@ class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate { Q_DECLARE_PUBLIC(QBlitterPaintEngine); public: - QBlitterPaintEnginePrivate(QBlittablePixmapData *p) + QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p) : QPaintEngineExPrivate(), pmData(p), isBlitterLocked(false), @@ -280,7 +280,7 @@ public: QRasterPaintEngine *raster; - QBlittablePixmapData *pmData; + QBlittablePlatformPixmap *pmData; bool isBlitterLocked; CapabilitiesToStateMask *capabillities; @@ -288,7 +288,7 @@ public: uint hasXForm; }; -QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePixmapData *p) +QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p) : QPaintEngineEx(*(new QBlitterPaintEnginePrivate(p))) { } diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index afd7486dc2..1acc647fbe 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -49,14 +49,14 @@ QT_BEGIN_NAMESPACE class QBlitterPaintEnginePrivate; -class QBlittablePixmapData; +class QBlittablePlatformPixmap; class QBlittable; class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx { Q_DECLARE_PRIVATE(QBlitterPaintEngine); public: - QBlitterPaintEngine(QBlittablePixmapData *p); + QBlitterPaintEngine(QBlittablePlatformPixmap *p); ~QBlitterPaintEngine(); virtual QPainterState *createState(QPainterState *orig) const; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 09ffc8ec59..b6b24d6abf 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -438,8 +438,8 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) if (device->devType() == QInternal::Pixmap) { QPixmap *pixmap = static_cast(device); - QPixmapData *pd = pixmap->pixmapData(); - if (pd->classId() == QPixmapData::RasterClass || pd->classId() == QPixmapData::BlitterClass) + QPlatformPixmap *pd = pixmap->handle(); + if (pd->classId() == QPlatformPixmap::RasterClass || pd->classId() == QPlatformPixmap::BlitterClass) d->device = pd->buffer(); } else { d->device = device; @@ -1989,9 +1989,9 @@ void QRasterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pixmap) qDebug() << " - QRasterPaintEngine::drawPixmap(), pos=" << pos << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth(); #endif - QPixmapData *pd = pixmap.pixmapData(); - if (pd->classId() == QPixmapData::RasterClass) { - const QImage &image = static_cast(pd)->image; + QPlatformPixmap *pd = pixmap.handle(); + if (pd->classId() == QPlatformPixmap::RasterClass) { + const QImage &image = static_cast(pd)->image; if (image.depth() == 1) { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); @@ -2030,9 +2030,9 @@ void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, cons qDebug() << " - QRasterPaintEngine::drawPixmap(), r=" << r << " sr=" << sr << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth(); #endif - QPixmapData* pd = pixmap.pixmapData(); - if (pd->classId() == QPixmapData::RasterClass) { - const QImage &image = static_cast(pd)->image; + QPlatformPixmap* pd = pixmap.handle(); + if (pd->classId() == QPlatformPixmap::RasterClass) { + const QImage &image = static_cast(pd)->image; if (image.depth() == 1) { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); @@ -2425,9 +2425,9 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, QImage image; - QPixmapData *pd = pixmap.pixmapData(); - if (pd->classId() == QPixmapData::RasterClass) { - image = static_cast(pd)->image; + QPlatformPixmap *pd = pixmap.handle(); + if (pd->classId() == QPlatformPixmap::RasterClass) { + image = static_cast(pd)->image; } else { image = pixmap.toImage(); } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 31a4b77047..d045bf55d1 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -84,7 +84,7 @@ #include #include -#include +#include #include #include #include "qcolormap.h" @@ -1836,15 +1836,15 @@ Q_GLOBAL_STATIC(QGLTextureCache, qt_gl_texture_cache) QGLTextureCache::QGLTextureCache() : m_cache(64*1024) // cache ~64 MB worth of textures - this is not accurate though { - QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(cleanupTexturesForPixampData); - QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(cleanupBeforePixmapDestruction); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(cleanupTexturesForPixampData); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey); } QGLTextureCache::~QGLTextureCache() { - QImagePixmapCleanupHooks::instance()->removePixmapDataModificationHook(cleanupTexturesForPixampData); - QImagePixmapCleanupHooks::instance()->removePixmapDataDestructionHook(cleanupBeforePixmapDestruction); + QImagePixmapCleanupHooks::instance()->removePlatformPixmapModificationHook(cleanupTexturesForPixampData); + QImagePixmapCleanupHooks::instance()->removePlatformPixmapDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey); } @@ -1903,18 +1903,18 @@ void QGLTextureCache::cleanupTexturesForCacheKey(qint64 cacheKey) } -void QGLTextureCache::cleanupTexturesForPixampData(QPixmapData* pmd) +void QGLTextureCache::cleanupTexturesForPixampData(QPlatformPixmap* pmd) { cleanupTexturesForCacheKey(pmd->cacheKey()); } -void QGLTextureCache::cleanupBeforePixmapDestruction(QPixmapData* pmd) +void QGLTextureCache::cleanupBeforePixmapDestruction(QPlatformPixmap* pmd) { // Remove any bound textures first: cleanupTexturesForPixampData(pmd); #if defined(Q_WS_X11) - if (pmd->classId() == QPixmapData::X11Class) { + if (pmd->classId() == QPlatformPixmap::X11Class) { Q_ASSERT(pmd->ref == 0); // Make sure reference counting isn't broken QGLContextPrivate::destroyGlSurfaceForPixmap(pmd); } @@ -2582,7 +2582,7 @@ QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum targe QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options) { Q_Q(QGLContext); - QPixmapData *pd = pixmap.pixmapData(); + QPlatformPixmap *pd = pixmap.handle(); Q_UNUSED(pd); const qint64 key = pixmap.cacheKey(); @@ -2601,7 +2601,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, #if defined(Q_WS_X11) // Try to use texture_from_pixmap const QX11Info *xinfo = qt_x11Info(paintDevice); - if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType + if (pd->classId() == QPlatformPixmap::X11Class && pd->pixelType() == QPlatformPixmap::PixmapType && xinfo && xinfo->screen() == pixmap.x11Info().screen() && target == GL_TEXTURE_2D && QApplication::instance()->thread() == QThread::currentThread()) @@ -4442,7 +4442,7 @@ QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext) int old_depth = qt_x11_preferred_pixmap_depth; qt_x11_preferred_pixmap_depth = x11Info().depth(); - QPixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); + QPlatformPixmap *data = new QX11PlatformPixmap(QPlatformPixmap::PixmapType); data->resize(sz.width(), sz.height()); QPixmap pm(data); qt_x11_preferred_pixmap_depth = old_depth; diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 34b448e048..dcf340fb10 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -280,16 +280,16 @@ void QGLContextPrivate::destroyEglSurfaceForDevice() EGLSurface QGLContextPrivate::eglSurfaceForDevice() const { - // If a QPixmapData had to create the QGLContext, we don't have a paintDevice + // If a QPlatformPixmap had to create the QGLContext, we don't have a paintDevice if (!paintDevice) return eglSurface; #ifdef Q_WS_X11 if (paintDevice->devType() == QInternal::Pixmap) { - QPixmapData *pmd = static_cast(paintDevice)->data_ptr().data(); - if (pmd->classId() == QPixmapData::X11Class) { - QX11PixmapData* x11PixmapData = static_cast(pmd); - return (EGLSurface)x11PixmapData->gl_surface; + QPlatformPixmap *pmd = static_cast(paintDevice)->data_ptr().data(); + if (pmd->classId() == QPlatformPixmap::X11Class) { + QX11PlatformPixmap* x11PlatformPixmap = static_cast(pmd); + return (EGLSurface)x11PlatformPixmap->gl_surface; } } #endif diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 5b69caeb3e..f2590e82b1 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -382,11 +382,11 @@ public: void* pbuf; quint32 gpm; int screen; - QHash boundPixmaps; + QHash boundPixmaps; QGLTexture *bindTextureFromNativePixmap(QPixmap*, const qint64 key, QGLContext::BindOptions options); - static void destroyGlSurfaceForPixmap(QPixmapData*); - static void unbindPixmapFromTexture(QPixmapData*); + static void destroyGlSurfaceForPixmap(QPlatformPixmap*); + static void unbindPixmapFromTexture(QPlatformPixmap*); #endif #if defined(Q_WS_MAC) bool update; @@ -502,18 +502,18 @@ class Q_OPENGL_EXPORT QGLTextureDestroyer : public QObject public: QGLTextureDestroyer() : QObject() { qRegisterMetaType("GLuint"); - connect(this, SIGNAL(freeTexture(QGLContext *, QPixmapData *, GLuint)), - this, SLOT(freeTexture_slot(QGLContext *, QPixmapData *, GLuint))); + connect(this, SIGNAL(freeTexture(QGLContext *, QPlatformPixmap *, GLuint)), + this, SLOT(freeTexture_slot(QGLContext *, QPlatformPixmap *, GLuint))); } - void emitFreeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { + void emitFreeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) { emit freeTexture(context, boundPixmap, id); } Q_SIGNALS: - void freeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id); + void freeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id); private slots: - void freeTexture_slot(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { + void freeTexture_slot(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) { Q_UNUSED(boundPixmap); #if defined(Q_WS_X11) if (boundPixmap) { @@ -565,7 +565,7 @@ public: if (options & QGLContext::MemoryManagedBindOption) { Q_ASSERT(context); #if !defined(Q_WS_X11) - QPixmapData *boundPixmap = 0; + QPlatformPixmap *boundPixmap = 0; #endif context->d_ptr->texture_destroyer->emitFreeTexture(context, boundPixmap, id); } @@ -578,7 +578,7 @@ public: QGLContext::BindOptions options; #if defined(Q_WS_X11) - QPixmapData* boundPixmap; + QPlatformPixmap* boundPixmap; #endif bool canBindCompressedTexture @@ -623,8 +623,8 @@ public: void removeContextTextures(QGLContext *ctx); static QGLTextureCache *instance(); static void cleanupTexturesForCacheKey(qint64 cacheKey); - static void cleanupTexturesForPixampData(QPixmapData* pixmap); - static void cleanupBeforePixmapDestruction(QPixmapData* pixmap); + static void cleanupTexturesForPixampData(QPlatformPixmap* pixmap); + static void cleanupBeforePixmapDestruction(QPlatformPixmap* pixmap); private: QCache m_cache; diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp index bc65bcd44a..de44607bb5 100644 --- a/src/opengl/qgl_symbian.cpp +++ b/src/opengl/qgl_symbian.cpp @@ -50,7 +50,7 @@ #include // to access QWExtra #include #include "qgl_egl_p.h" -#include "qpixmapdata_gl_p.h" +#include "qplatformpixmap_gl_p.h" #include "qgltexturepool_p.h" #include "qcolormap.h" #include @@ -381,9 +381,9 @@ static inline bool knownGoodFormat(QImage::Format format) } } -void QGLPixmapData::fromNativeType(void* pixmap, NativeType type) +void QGLPlatformPixmap::fromNativeType(void* pixmap, NativeType type) { - if (type == QPixmapData::FbsBitmap) { + if (type == QPlatformPixmap::FbsBitmap) { CFbsBitmap *bitmap = reinterpret_cast(pixmap); QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight); if (size.width() == w && size.height() == h) @@ -402,7 +402,7 @@ void QGLPixmapData::fromNativeType(void* pixmap, NativeType type) m_hasFillColor = false; m_dirty = true; - } else if (type == QPixmapData::VolatileImage && pixmap) { + } else if (type == QPlatformPixmap::VolatileImage && pixmap) { // Support QS60Style in more efficient skin graphics retrieval. QVolatileImage *img = static_cast(pixmap); if (img->width() == w && img->height() == h) @@ -412,7 +412,7 @@ void QGLPixmapData::fromNativeType(void* pixmap, NativeType type) m_hasAlpha = m_source.hasAlphaChannel(); m_hasFillColor = false; m_dirty = true; - } else if (type == QPixmapData::NativeImageHandleProvider && pixmap) { + } else if (type == QPlatformPixmap::NativeImageHandleProvider && pixmap) { destroyTexture(); nativeImageHandleProvider = static_cast(pixmap); // Cannot defer the retrieval, we need at least the size right away. @@ -420,9 +420,9 @@ void QGLPixmapData::fromNativeType(void* pixmap, NativeType type) } } -void* QGLPixmapData::toNativeType(NativeType type) +void* QGLPlatformPixmap::toNativeType(NativeType type) { - if (type == QPixmapData::FbsBitmap) { + if (type == QPlatformPixmap::FbsBitmap) { if (m_source.isNull()) m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied); return m_source.duplicateNativeImage(); @@ -431,19 +431,19 @@ void* QGLPixmapData::toNativeType(NativeType type) return 0; } -bool QGLPixmapData::initFromNativeImageHandle(void *handle, const QString &type) +bool QGLPlatformPixmap::initFromNativeImageHandle(void *handle, const QString &type) { if (type == QLatin1String("RSgImage")) { - fromNativeType(handle, QPixmapData::SgImage); + fromNativeType(handle, QPlatformPixmap::SgImage); return true; } else if (type == QLatin1String("CFbsBitmap")) { - fromNativeType(handle, QPixmapData::FbsBitmap); + fromNativeType(handle, QPlatformPixmap::FbsBitmap); return true; } return false; } -void QGLPixmapData::createFromNativeImageHandleProvider() +void QGLPlatformPixmap::createFromNativeImageHandleProvider() { void *handle = 0; QString type; @@ -453,14 +453,14 @@ void QGLPixmapData::createFromNativeImageHandleProvider() nativeImageHandle = handle; nativeImageType = type; } else { - qWarning("QGLPixmapData: Unknown native image type '%s'", qPrintable(type)); + qWarning("QGLPlatformPixmap: Unknown native image type '%s'", qPrintable(type)); } } else { - qWarning("QGLPixmapData: Native handle is null"); + qWarning("QGLPlatformPixmap: Native handle is null"); } } -void QGLPixmapData::releaseNativeImageHandle() +void QGLPlatformPixmap::releaseNativeImageHandle() { if (nativeImageHandleProvider && nativeImageHandle) { nativeImageHandleProvider->release(nativeImageHandle, nativeImageType); diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 18b6eaaf91..1fd9e373ed 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1769,17 +1769,17 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons Q_Q(QGLContext); - QX11PixmapData *pixmapData = static_cast(pixmap->data_ptr().data()); - Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); + QX11PlatformPixmap *handle = static_cast(pixmap->data_ptr().data()); + Q_ASSERT(handle->classId() == QPlatformPixmap::X11Class); // We can't use TFP if the pixmap has a separate X11 mask - if (pixmapData->x11_mask) + if (handle->x11_mask) return 0; if (!qt_resolveTextureFromPixmap(paintDevice)) return 0; - const QX11Info &x11Info = pixmapData->xinfo; + const QX11Info &x11Info = handle->xinfo; // Store the configs (Can be static because configs aren't dependent on current context) static GLXFBConfig glxRGBPixmapConfig = 0; @@ -1787,7 +1787,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons static GLXFBConfig glxRGBAPixmapConfig = 0; static bool RGBAConfigInverted = false; - bool hasAlpha = pixmapData->hasAlphaChannel(); + bool hasAlpha = handle->hasAlphaChannel(); // Check to see if we need a config if ( (hasAlpha && !glxRGBAPixmapConfig) || (!hasAlpha && !glxRGBPixmapConfig) ) { @@ -1822,15 +1822,15 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons } // Check to see if the surface is still valid - if (pixmapData->gl_surface && - hasAlpha != (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) + if (handle->gl_surface && + hasAlpha != (handle->flags & QX11PlatformPixmap::GlSurfaceCreatedWithAlpha)) { // Surface is invalid! - destroyGlSurfaceForPixmap(pixmapData); + destroyGlSurfaceForPixmap(handle); } // Check to see if we need a surface - if (!pixmapData->gl_surface) { + if (!handle->gl_surface) { GLXPixmap glxPixmap; int pixmapAttribs[] = { GLX_TEXTURE_FORMAT_EXT, hasAlpha ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT, @@ -1842,21 +1842,21 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons // Wrap the X Pixmap into a GLXPixmap: glxPixmap = glXCreatePixmap(x11Info.display(), hasAlpha ? glxRGBAPixmapConfig : glxRGBPixmapConfig, - pixmapData->handle(), pixmapAttribs); + handle->handle(), pixmapAttribs); if (!glxPixmap) return 0; - pixmapData->gl_surface = (void*)glxPixmap; + handle->gl_surface = (void*)glxPixmap; // Make sure the cleanup hook gets called so we can delete the glx pixmap - QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); + QImagePixmapCleanupHooks::enableCleanupHooks(handle); } GLuint textureId; glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); - glXBindTexImageEXT(x11Info.display(), (GLXPixmap)pixmapData->gl_surface, GLX_FRONT_LEFT_EXT, 0); + glXBindTexImageEXT(x11Info.display(), (GLXPixmap)handle->gl_surface, GLX_FRONT_LEFT_EXT, 0); glBindTexture(GL_TEXTURE_2D, textureId); GLuint filtering = (options & QGLContext::LinearFilteringBindOption) ? GL_LINEAR : GL_NEAREST; @@ -1868,7 +1868,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); if (texture->options & QGLContext::InvertedYBindOption) - pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; + handle->flags |= QX11PlatformPixmap::InvertedWhenBoundToTexture; // We assume the cost of bound pixmaps is zero QGLTextureCache::instance()->insert(q, key, texture, 0); @@ -1878,26 +1878,26 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons } -void QGLContextPrivate::destroyGlSurfaceForPixmap(QPixmapData* pmd) +void QGLContextPrivate::destroyGlSurfaceForPixmap(QPlatformPixmap* pmd) { #if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast(pmd); - if (pixmapData->gl_surface) { - glXDestroyPixmap(QX11Info::display(), (GLXPixmap)pixmapData->gl_surface); - pixmapData->gl_surface = 0; + Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class); + QX11PlatformPixmap *handle = static_cast(pmd); + if (handle->gl_surface) { + glXDestroyPixmap(QX11Info::display(), (GLXPixmap)handle->gl_surface); + handle->gl_surface = 0; } #endif } -void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd) +void QGLContextPrivate::unbindPixmapFromTexture(QPlatformPixmap* pmd) { #if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); + Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class); Q_ASSERT(QGLContext::currentContext()); - QX11PixmapData *pixmapData = static_cast(pmd); - if (pixmapData->gl_surface) - glXReleaseTexImageEXT(QX11Info::display(), (GLXPixmap)pixmapData->gl_surface, GLX_FRONT_LEFT_EXT); + QX11PlatformPixmap *handle = static_cast(pmd); + if (handle->gl_surface) + glXReleaseTexImageEXT(QX11Info::display(), (GLXPixmap)handle->gl_surface, GLX_FRONT_LEFT_EXT); #endif } diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index a491bef4c6..e8520414d6 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -171,13 +171,13 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) int devType = device()->devType(); - QX11PixmapData *x11PixmapData = 0; + QX11PlatformPixmap *x11PlatformPixmap = 0; if (devType == QInternal::Pixmap) { - QPixmapData *pmd = static_cast(device())->data_ptr().data(); - if (pmd->classId() == QPixmapData::X11Class) - x11PixmapData = static_cast(pmd); + QPlatformPixmap *pmd = static_cast(device())->data_ptr().data(); + if (pmd->classId() == QPlatformPixmap::X11Class) + x11PlatformPixmap = static_cast(pmd); else { - // TODO: Replace the pixmap's data with a new QX11PixmapData + // TODO: Replace the pixmap's data with a new QX11PlatformPixmap qWarning("WARNING: Creating a QGLContext on a QPixmap is only supported for X11 pixmap backend"); return false; } @@ -234,7 +234,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // Do don't create the EGLSurface for everything. // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface // QGLWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface - // QPixmap - yes, create the EGLSurface but store it in QX11PixmapData::gl_surface + // QPixmap - yes, create the EGLSurface but store it in QX11PlatformPixmap::gl_surface // QGLPixelBuffer - no, it creates the surface itself and stores it in QGLPixelBufferPrivate::pbuf if (devType == QInternal::Widget) { @@ -246,12 +246,12 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) setWindowCreated(true); } - if (x11PixmapData) { + if (x11PlatformPixmap) { // TODO: Actually check to see if the existing surface can be re-used - if (x11PixmapData->gl_surface) - eglDestroySurface(d->eglContext->display(), (EGLSurface)x11PixmapData->gl_surface); + if (x11PlatformPixmap->gl_surface) + eglDestroySurface(d->eglContext->display(), (EGLSurface)x11PlatformPixmap->gl_surface); - x11PixmapData->gl_surface = (void*)QEgl::createSurface(device(), d->eglContext->config()); + x11PlatformPixmap->gl_surface = (void*)QEgl::createSurface(device(), d->eglContext->config()); } return true; @@ -415,17 +415,17 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons return 0; - QX11PixmapData *pixmapData = static_cast(pixmap->data_ptr().data()); - Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); - bool hasAlpha = pixmapData->hasAlphaChannel(); + QX11PlatformPixmap *handle = static_cast(pixmap->data_ptr().data()); + Q_ASSERT(handle->classId() == QPlatformPixmap::X11Class); + bool hasAlpha = handle->hasAlphaChannel(); bool pixmapHasValidSurface = false; bool textureIsBound = false; GLuint textureId; glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); - if (haveTFP && pixmapData->gl_surface && - hasAlpha == (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) + if (haveTFP && handle->gl_surface && + hasAlpha == (handle->flags & QX11PlatformPixmap::GlSurfaceCreatedWithAlpha)) { pixmapHasValidSurface = true; } @@ -433,11 +433,11 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons // If we already have a valid EGL surface for the pixmap, we should use it if (pixmapHasValidSurface) { EGLBoolean success; - success = eglBindTexImage(QEgl::display(), (EGLSurface)pixmapData->gl_surface, EGL_BACK_BUFFER); + success = eglBindTexImage(QEgl::display(), (EGLSurface)handle->gl_surface, EGL_BACK_BUFFER); if (success == EGL_FALSE) { qWarning() << "eglBindTexImage() failed:" << QEgl::errorString(); - eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); - pixmapData->gl_surface = (void*)EGL_NO_SURFACE; + eglDestroySurface(QEgl::display(), (EGLSurface)handle->gl_surface); + handle->gl_surface = (void*)EGL_NO_SURFACE; } else textureIsBound = true; } @@ -469,29 +469,29 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons if (!textureIsBound && haveTFP) { // Check to see if the surface is still valid - if (pixmapData->gl_surface && - hasAlpha != (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) + if (handle->gl_surface && + hasAlpha != (handle->flags & QX11PlatformPixmap::GlSurfaceCreatedWithAlpha)) { // Surface is invalid! - destroyGlSurfaceForPixmap(pixmapData); + destroyGlSurfaceForPixmap(handle); } - if (pixmapData->gl_surface == 0) { + if (handle->gl_surface == 0) { EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap, QEgl::OpenGL, hasAlpha ? QEgl::Translucent : QEgl::NoOptions); - pixmapData->gl_surface = (void*)QEgl::createSurface(pixmap, config); - if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE) + handle->gl_surface = (void*)QEgl::createSurface(pixmap, config); + if (handle->gl_surface == (void*)EGL_NO_SURFACE) return false; } EGLBoolean success; - success = eglBindTexImage(QEgl::display(), (EGLSurface)pixmapData->gl_surface, EGL_BACK_BUFFER); + success = eglBindTexImage(QEgl::display(), (EGLSurface)handle->gl_surface, EGL_BACK_BUFFER); if (success == EGL_FALSE) { qWarning() << "eglBindTexImage() failed:" << QEgl::errorString(); - eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); - pixmapData->gl_surface = (void*)EGL_NO_SURFACE; + eglDestroySurface(QEgl::display(), (EGLSurface)handle->gl_surface); + handle->gl_surface = (void*)EGL_NO_SURFACE; haveTFP = false; // If TFP isn't working, disable it's use } else textureIsBound = true; @@ -501,7 +501,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons if (textureIsBound) { texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); - pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; + handle->flags |= QX11PlatformPixmap::InvertedWhenBoundToTexture; // We assume the cost of bound pixmaps is zero QGLTextureCache::instance()->insert(q, key, texture, 0); @@ -514,29 +514,29 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons } -void QGLContextPrivate::destroyGlSurfaceForPixmap(QPixmapData* pmd) +void QGLContextPrivate::destroyGlSurfaceForPixmap(QPlatformPixmap* pmd) { - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast(pmd); - if (pixmapData->gl_surface) { + Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class); + QX11PlatformPixmap *handle = static_cast(pmd); + if (handle->gl_surface) { EGLBoolean success; - success = eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); + success = eglDestroySurface(QEgl::display(), (EGLSurface)handle->gl_surface); if (success == EGL_FALSE) { qWarning() << "destroyGlSurfaceForPixmap() - Error deleting surface: " << QEgl::errorString(); } - pixmapData->gl_surface = 0; + handle->gl_surface = 0; } } -void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd) +void QGLContextPrivate::unbindPixmapFromTexture(QPlatformPixmap* pmd) { - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast(pmd); - if (pixmapData->gl_surface) { + Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class); + QX11PlatformPixmap *handle = static_cast(pmd); + if (handle->gl_surface) { EGLBoolean success; success = eglReleaseTexImage(QEgl::display(), - (EGLSurface)pixmapData->gl_surface, + (EGLSurface)handle->gl_surface, EGL_BACK_BUFFER); if (success == EGL_FALSE) { qWarning() << "unbindPixmapFromTexture() - Unable to release bound texture: " diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index c9815ec91a..6c807248ee 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -42,7 +42,7 @@ #include "private/qpixmapfilter_p.h" #include "private/qpaintengineex_opengl2_p.h" #include "private/qglengineshadermanager_p.h" -#include "private/qpixmapdata_p.h" +#include "qplatformpixmap_qpa.h" #include "private/qimagepixmapcleanuphooks_p.h" #include "qglpixmapfilter_p.h" #include "qpaintengine_opengl_p.h" @@ -324,7 +324,7 @@ public: void timerEvent(QTimerEvent *event); private: - static void pixmapDestroyed(QPixmapData *pixmap); + static void pixmapDestroyed(QPlatformPixmap *pixmap); QCache cache; @@ -380,8 +380,8 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe { static bool hookAdded = false; if (!hookAdded) { - QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(pixmapDestroyed); - QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(pixmapDestroyed); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(pixmapDestroyed); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(pixmapDestroyed); hookAdded = true; } @@ -394,7 +394,7 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe timerId = startTimer(8000); } -void QGLBlurTextureCache::pixmapDestroyed(QPixmapData *pmd) +void QGLBlurTextureCache::pixmapDestroyed(QPlatformPixmap *pmd) { foreach (QGLBlurTextureCache *cache, blurTextureCaches) { if (cache->hasBlurTextureInfo(pmd->cacheKey())) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 031d4056fb..a3895d0073 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -76,7 +76,7 @@ public: ~QCocoaIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 4d01aa0a80..95794cf452 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -103,9 +103,9 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons -QPixmapData *QCocoaIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QCocoaIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWindow *window) const diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp index 86a8bf7cb7..a4da2d8142 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp +++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp @@ -92,10 +92,10 @@ void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) { - QPixmapData *data = pixmap.pixmapData(); + QPlatformPixmap *data = pixmap.handle(); Q_ASSERT(data->width() && data->height()); - Q_ASSERT(data->classId() == QPixmapData::BlitterClass); - QBlittablePixmapData *blitPm = static_cast(data); + Q_ASSERT(data->classId() == QPlatformPixmap::BlitterClass); + QBlittablePlatformPixmap *blitPm = static_cast(data); QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); dfbBlitter->unlock(); diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h index 16d7599c83..2dcb2be07a 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.h +++ b/src/plugins/platforms/directfb/qdirectfbblitter.h @@ -67,7 +67,7 @@ protected: friend class QDirectFbConvenience; }; -class QDirectFbBlitterPixmapData : public QBlittablePixmapData +class QDirectFbBlitterPlatformPixmap : public QBlittablePlatformPixmap { public: QBlittable *createBlittable(const QSize &size) const { return new QDirectFbBlitter(size); } diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp index 37810dc461..38130c8deb 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp @@ -106,9 +106,9 @@ int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat forma return ((0x1f << 7) & format) >> 7; } -IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) +IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPlatformPixmap(QPlatformPixmap *handle) { - QBlittablePixmapData *blittablePmData = static_cast(pixmapData); + QBlittablePlatformPixmap *blittablePmData = static_cast(handle); if (blittablePmData) { QBlittable *blittable = blittablePmData->blittable(); QDirectFbBlitter *dfbBlitter = static_cast(blittable); diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h index c82bea84c7..93d47f3644 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.h +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h @@ -67,7 +67,7 @@ public: static IDirectFB *dfbInterface(); static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); - static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); + static IDirectFBSurface *dfbSurfaceForPlatformPixmap(QPlatformPixmap *); static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp index 8a38bc4e83..0a2a872b0a 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp +++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp @@ -70,7 +70,7 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) map = cursor->pixmap(); } - IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); + IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPlatformPixmap(map.handle()); if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { return; diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index 018a5d9e2d..ed8e42faf4 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -53,7 +53,7 @@ #include #include -#include +#include #include #include #include @@ -118,12 +118,12 @@ QDirectFbIntegration::~QDirectFbIntegration() delete mInput; } -QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QDirectFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - if (type == QPixmapData::BitmapType) - return new QRasterPixmapData(type); + if (type == QPlatformPixmap::BitmapType) + return new QRasterPlatformPixmap(type); else - return new QDirectFbBlitterPixmapData; + return new QDirectFbBlitterPlatformPixmap; } QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h index 8195ebd4b5..c3030031e1 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.h +++ b/src/plugins/platforms/directfb/qdirectfbintegration.h @@ -85,7 +85,7 @@ public: QDirectFbIntegration(); ~QDirectFbIntegration(); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QAbstractEventDispatcher *createEventDispatcher() const; diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp index 730f01fa1b..0cb3261eb1 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp @@ -63,7 +63,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId) dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); //WRONGSIZE QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); - m_pmdata = new QDirectFbBlitterPixmapData; + m_pmdata = new QDirectFbBlitterPlatformPixmap; m_pmdata->setBlittable(blitter); m_pixmap = new QPixmap(m_pmdata); } diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h index 7f1140d4eb..5a631ca8fa 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h @@ -67,7 +67,7 @@ private: void lockSurfaceToImage(); QPixmap *m_pixmap; - QBlittablePixmapData *m_pmdata; + QBlittablePlatformPixmap *m_pmdata; IDirectFBSurface *m_dfbSurface; }; diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 9e8596f19e..716ae8a78e 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -73,12 +73,12 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons } } -QPixmapData *QEglFSIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QEglFSIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { #ifdef QEGL_EXTRA_DEBUG - qWarning("QEglIntegration::createPixmapData %d\n", type); + qWarning("QEglIntegration::createPlatformPixmap %d\n", type); #endif - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index 6252a9c0e4..9b86a0484e 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -57,7 +57,7 @@ public: QEglFSIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index c2388ceb85..1c098a0ffc 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -792,9 +792,9 @@ bool QLinuxFbIntegration::hasCapability(QPlatformIntegration::Capability cap) co } -QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QLinuxFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QWindowSurface *QLinuxFbIntegration::createWindowSurface(QWidget *widget, WId) const diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index 62c2a59187..f972a30452 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -80,7 +80,7 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const; QAbstractEventDispatcher *createEventDispatcher() const; diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index d9f4801f70..71bdda73aa 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -69,9 +69,9 @@ bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) co } } -QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QMinimalIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index dc111757db..52e4c0a6f3 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -71,7 +71,7 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QAbstractEventDispatcher *createEventDispatcher() const; diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 89475db54b..38c4325bb4 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -43,7 +43,7 @@ #include "qopenkodewindow.h" #include "qopenkodeeventloopintegration.h" -#include +#include #include #include @@ -197,9 +197,9 @@ bool QOpenKODEIntegration::hasCapability(QPlatformIntegration::Capability cap) c } } -QPixmapData *QOpenKODEIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QOpenKODEIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QGLPixmapData(type); + return new QGLPlatformPixmap(type); } QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) const diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index 0f001c957b..fb68e123cc 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -92,7 +92,7 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp index 203896f489..d8e4cc984c 100644 --- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp @@ -41,7 +41,7 @@ #include "qgraphicssystem_vglite.h" #include "qwindowsurface_vglite.h" -#include +#include #include #include #ifdef OPENVG_USBHP_INIT @@ -163,16 +163,16 @@ QVGLiteGraphicsSystem::~QVGLiteGraphicsSystem() { } -QPixmapData *QVGLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QVGLiteGraphicsSystem::createPlatformPixmap(QPlatformPixmap::PixelType type) const { #if !defined(QVGLite_NO_SINGLE_CONTEXT) && !defined(QVGLite_NO_PIXMAP_DATA) - // Pixmaps can use QVGLitePixmapData; bitmaps must use raster. - if (type == QPixmapData::PixmapType) - return new QVGPixmapData(type); + // Pixmaps can use QVGLitePlatformPixmap; bitmaps must use raster. + if (type == QPlatformPixmap::PixmapType) + return new QVGPlatformPixmap(type); else - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); #else - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); #endif } diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h index 41b1d286bc..6dc6a38439 100644 --- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h @@ -57,7 +57,7 @@ public: QVGLiteGraphicsSystem(); ~QVGLiteGraphicsSystem(); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QWindowSurface *createWindowSurface(QWidget *widget) const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index 214f6a8368..d4d8183936 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -423,9 +423,9 @@ QVFbIntegration::QVFbIntegration(const QStringList ¶mList) mScreens.append(mPrimaryScreen); } -QPixmapData *QVFbIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QVFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QWindowSurface *QVFbIntegration::createWindowSurface(QWidget *widget, WId) const diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h index aaf20a37ec..1c736c24e0 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.h +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -79,7 +79,7 @@ class QVFbIntegration : public QPlatformIntegration public: QVFbIntegration(const QStringList ¶mList); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QAbstractEventDispatcher *createEventDispatcher() const; diff --git a/src/plugins/platforms/uikit/quikitintegration.h b/src/plugins/platforms/uikit/quikitintegration.h index 92247fdff3..b8a15b3807 100644 --- a/src/plugins/platforms/uikit/quikitintegration.h +++ b/src/plugins/platforms/uikit/quikitintegration.h @@ -52,7 +52,7 @@ public: QUIKitIntegration(); ~QUIKitIntegration(); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm index 737fa40d05..37ba2b9a02 100644 --- a/src/plugins/platforms/uikit/quikitintegration.mm +++ b/src/plugins/platforms/uikit/quikitintegration.mm @@ -64,9 +64,9 @@ QUIKitIntegration::~QUIKitIntegration() { } -QPixmapData *QUIKitIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QUIKitIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QPlatformWindow *QUIKitIntegration::createPlatformWindow(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 459eefd599..7506bff307 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -161,9 +161,9 @@ bool QVNCIntegration::hasCapability(QPlatformIntegration::Capability cap) const } -QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QVNCIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index dbdac51c73..9787a59f0f 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -82,7 +82,7 @@ public: QVNCIntegration(const QStringList& paramList); bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QAbstractEventDispatcher createEventDispatcher() const; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9a581c265f..800f1fc99c 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -92,9 +92,9 @@ bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) co } } -QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QWaylandIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index c08c040261..b9a01dab8d 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -56,7 +56,7 @@ public: QWaylandIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index fcc17b28b2..924077f00d 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -102,9 +102,9 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const } } -QPixmapData *QXcbIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QXcbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index a89ffc89c6..725db7a53d 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -57,7 +57,7 @@ public: ~QXcbIntegration(); bool hasCapability(Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index f659d439ec..bf3f06b081 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -59,7 +59,7 @@ #include #endif //!defined(QT_OPENGL_ES_2) #include -#include +#include #endif //QT_NO_OPENGL QT_BEGIN_NAMESPACE @@ -83,13 +83,13 @@ bool QXlibIntegration::hasCapability(QPlatformIntegration::Capability cap) const } } -QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QXlibIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { #ifndef QT_NO_OPENGL if (mUseOpenGL) - return new QGLPixmapData(type); + return new QGLPlatformPixmap(type); #endif - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h index ce5f35a41d..3261e1a7fc 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.h +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -61,7 +61,7 @@ public: QXlibIntegration(bool useOpenGL = false); bool hasCapability(Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QAbstractEventDispatcher *createEventDispatcher() const; diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h index 5b06656b17..b0edd8d4b0 100644 --- a/src/widgets/effects/qpixmapfilter_p.h +++ b/src/widgets/effects/qpixmapfilter_p.h @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QPainter; -class QPixmapData; +class QPlatformPixmap; class QPixmapFilterPrivate; diff --git a/src/widgets/platforms/mac/qpaintdevice_mac.cpp b/src/widgets/platforms/mac/qpaintdevice_mac.cpp index d29047bf50..50bd4b8490 100644 --- a/src/widgets/platforms/mac/qpaintdevice_mac.cpp +++ b/src/widgets/platforms/mac/qpaintdevice_mac.cpp @@ -121,16 +121,16 @@ Q_WIDGETS_EXPORT CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) CGContextRef ret = 0; // It would make sense to put this into a mac #ifdef'ed - // virtual function in the QPixmapData at some point - if (pm->data->classId() == QPixmapData::MacClass) { - const QMacPixmapData *pmData = static_cast(pm->data.data()); + // virtual function in the QPlatformPixmap at some point + if (pm->data->classId() == QPlatformPixmap::MacClass) { + const QMacPlatformPixmap *pmData = static_cast(pm->data.data()); ret = CGBitmapContextCreate(pmData->pixels, pmData->w, pmData->h, 8, pmData->bytesPerRow, colorspace, flags); if(!ret) qWarning("QPaintDevice: Unable to create context for pixmap (%d/%d/%d)", pmData->w, pmData->h, (pmData->bytesPerRow * pmData->h)); - } else if (pm->data->classId() == QPixmapData::RasterClass) { + } else if (pm->data->classId() == QPlatformPixmap::RasterClass) { QImage *image = pm->data->buffer(); ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(), 8, image->bytesPerLine(), colorspace, flags); diff --git a/src/widgets/platforms/mac/qpixmap_mac.cpp b/src/widgets/platforms/mac/qpixmap_mac.cpp index da08878427..05f01387fa 100644 --- a/src/widgets/platforms/mac/qpixmap_mac.cpp +++ b/src/widgets/platforms/mac/qpixmap_mac.cpp @@ -75,26 +75,26 @@ static int qt_pixmap_serial = 0; Q_WIDGETS_EXPORT quint32 *qt_mac_pixmap_get_base(const QPixmap *pix) { if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) - return reinterpret_cast(static_cast(pix->data.data())->buffer()->bits()); + return reinterpret_cast(static_cast(pix->data.data())->buffer()->bits()); else - return static_cast(pix->data.data())->pixels; + return static_cast(pix->data.data())->pixels; } Q_WIDGETS_EXPORT int qt_mac_pixmap_get_bytes_per_line(const QPixmap *pix) { if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) - return static_cast(pix->data.data())->buffer()->bytesPerLine(); + return static_cast(pix->data.data())->buffer()->bytesPerLine(); else - return static_cast(pix->data.data())->bytesPerRow; + return static_cast(pix->data.data())->bytesPerRow; } void qt_mac_cgimage_data_free(void *info, const void *memoryToFree, size_t) { - QMacPixmapData *pmdata = static_cast(info); + QMacPlatformPixmap *pmdata = static_cast(info); if (!pmdata) { free(const_cast(memoryToFree)); } else { - if (QMacPixmapData::validDataPointers.contains(pmdata) == false) { + if (QMacPlatformPixmap::validDataPointers.contains(pmdata) == false) { free(const_cast(memoryToFree)); return; } @@ -163,26 +163,26 @@ static inline QRgb qt_conv16ToRgb(ushort c) { return qRgb(tr,tg,tb); } -QSet QMacPixmapData::validDataPointers; +QSet QMacPlatformPixmap::validDataPointers; -QMacPixmapData::QMacPixmapData(PixelType type) - : QPixmapData(type, MacClass), has_alpha(0), has_mask(0), +QMacPlatformPixmap::QMacPlatformPixmap(PixelType type) + : QPlatformPixmap(type, MacClass), has_alpha(0), has_mask(0), uninit(true), pixels(0), pixelsSize(0), pixelsToFree(0), bytesPerRow(0), cg_data(0), cg_dataBeingReleased(0), cg_mask(0), pengine(0) { } -QPixmapData *QMacPixmapData::createCompatiblePixmapData() const +QPlatformPixmap *QMacPlatformPixmap::createCompatiblePlatformPixmap() const { - return new QMacPixmapData(pixelType()); + return new QMacPlatformPixmap(pixelType()); } #define BEST_BYTE_ALIGNMENT 16 #define COMPTUE_BEST_BYTES_PER_ROW(bpr) \ (((bpr) + (BEST_BYTE_ALIGNMENT - 1)) & ~(BEST_BYTE_ALIGNMENT - 1)) -void QMacPixmapData::resize(int width, int height) +void QMacPlatformPixmap::resize(int width, int height) { setSerialNumber(++qt_pixmap_serial); @@ -214,7 +214,7 @@ void QMacPixmapData::resize(int width, int height) #undef COMPUTE_BEST_BYTES_PER_ROW -void QMacPixmapData::fromImage(const QImage &img, +void QMacPlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { setSerialNumber(++qt_pixmap_serial); @@ -371,7 +371,7 @@ int get_index(QImage * qi,QRgb mycol) return qi->colorCount(); } -QImage QMacPixmapData::toImage() const +QImage QMacPlatformPixmap::toImage() const { QImage::Format format = QImage::Format_MonoLSB; if (d != 1) //Doesn't support index color modes @@ -405,7 +405,7 @@ QImage QMacPixmapData::toImage() const return image; } -void QMacPixmapData::fill(const QColor &fillColor) +void QMacPlatformPixmap::fill(const QColor &fillColor) { { //we don't know what backend to use so we cannot paint here @@ -427,39 +427,39 @@ void QMacPixmapData::fill(const QColor &fillColor) macSetHasAlpha(true); } -QPixmap QMacPixmapData::alphaChannel() const +QPixmap QMacPlatformPixmap::alphaChannel() const { if (!has_alpha) return QPixmap(); - QMacPixmapData *alpha = new QMacPixmapData(PixmapType); + QMacPlatformPixmap *alpha = new QMacPlatformPixmap(PixmapType); alpha->resize(w, h); macGetAlphaChannel(alpha, false); return QPixmap(alpha); } -void QMacPixmapData::setAlphaChannel(const QPixmap &alpha) +void QMacPlatformPixmap::setAlphaChannel(const QPixmap &alpha) { has_mask = true; - QMacPixmapData *alphaData = static_cast(alpha.data.data()); + QMacPlatformPixmap *alphaData = static_cast(alpha.data.data()); macSetAlphaChannel(alphaData, false); } -QBitmap QMacPixmapData::mask() const +QBitmap QMacPlatformPixmap::mask() const { if (!has_mask && !has_alpha) return QBitmap(); - QMacPixmapData *mask = new QMacPixmapData(BitmapType); + QMacPlatformPixmap *mask = new QMacPlatformPixmap(BitmapType); mask->resize(w, h); macGetAlphaChannel(mask, true); return QPixmap(mask); } -void QMacPixmapData::setMask(const QBitmap &mask) +void QMacPlatformPixmap::setMask(const QBitmap &mask) { if (mask.isNull()) { - QMacPixmapData opaque(PixmapType); + QMacPlatformPixmap opaque(PixmapType); opaque.resize(w, h); opaque.fill(QColor(255, 255, 255, 255)); macSetAlphaChannel(&opaque, true); @@ -469,11 +469,11 @@ void QMacPixmapData::setMask(const QBitmap &mask) has_alpha = false; has_mask = true; - QMacPixmapData *maskData = static_cast(mask.data.data()); + QMacPlatformPixmap *maskData = static_cast(mask.data.data()); macSetAlphaChannel(maskData, true); } -int QMacPixmapData::metric(QPaintDevice::PaintDeviceMetric theMetric) const +int QMacPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric theMetric) const { switch (theMetric) { case QPaintDevice::PdmWidth: @@ -504,7 +504,7 @@ int QMacPixmapData::metric(QPaintDevice::PaintDeviceMetric theMetric) const return 0; } -QMacPixmapData::~QMacPixmapData() +QMacPlatformPixmap::~QMacPlatformPixmap() { validDataPointers.remove(this); if (cg_mask) { @@ -521,7 +521,7 @@ QMacPixmapData::~QMacPixmapData() free(pixelsToFree); } -void QMacPixmapData::macSetAlphaChannel(const QMacPixmapData *pix, bool asMask) +void QMacPlatformPixmap::macSetAlphaChannel(const QMacPlatformPixmap *pix, bool asMask) { if (!pixels || !h || !w || pix->w != w || pix->h != h) return; @@ -567,7 +567,7 @@ void QMacPixmapData::macSetAlphaChannel(const QMacPixmapData *pix, bool asMask) macSetHasAlpha(true); } -void QMacPixmapData::macGetAlphaChannel(QMacPixmapData *pix, bool asMask) const +void QMacPlatformPixmap::macGetAlphaChannel(QMacPlatformPixmap *pix, bool asMask) const { quint32 *dptr = pix->pixels, *drow; const uint dbpr = pix->bytesPerRow; @@ -592,13 +592,13 @@ void QMacPixmapData::macGetAlphaChannel(QMacPixmapData *pix, bool asMask) const } } -void QMacPixmapData::macSetHasAlpha(bool b) +void QMacPlatformPixmap::macSetHasAlpha(bool b) { has_alpha = b; macReleaseCGImageRef(); } -void QMacPixmapData::macCreateCGImageRef() +void QMacPlatformPixmap::macCreateCGImageRef() { Q_ASSERT(cg_data == 0); //create the cg data @@ -615,7 +615,7 @@ void QMacPixmapData::macCreateCGImageRef() cgflags, provider, 0, 0, kCGRenderingIntentDefault); } -void QMacPixmapData::macReleaseCGImageRef() +void QMacPlatformPixmap::macReleaseCGImageRef() { if (!cg_data) return; // There's nothing we need to do @@ -634,7 +634,7 @@ void QMacPixmapData::macReleaseCGImageRef() // We create our space in memory to paint on here. If we already have existing pixels // copy them over. This is to preserve the fact that CGImageRef's are immutable. -void QMacPixmapData::macCreatePixels() +void QMacPlatformPixmap::macCreatePixels() { const int numBytes = bytesPerRow * h; quint32 *base_pixels; @@ -654,7 +654,7 @@ void QMacPixmapData::macCreatePixels() } #if 0 -QPixmap QMacPixmapData::transformed(const QTransform &transform, +QPixmap QMacPlatformPixmap::transformed(const QTransform &transform, Qt::TransformationMode mode) const { int w, h; // size of target pixmap @@ -682,15 +682,15 @@ QPixmap QMacPixmapData::transformed(const QTransform &transform, return QPixmap(); // create destination - QMacPixmapData *pm = new QMacPixmapData(pixelType(), w, h); + QMacPlatformPixmap *pm = new QMacPlatformPixmap(pixelType(), w, h); const quint32 *sptr = pixels; quint32 *dptr = pm->pixels; memset(dptr, 0, (pm->bytesPerRow * pm->h)); // do the transform if (mode == Qt::SmoothTransformation) { -#warning QMacPixmapData::transformed not properly implemented - qWarning("QMacPixmapData::transformed not properly implemented"); +#warning QMacPlatformPixmap::transformed not properly implemented + qWarning("QMacPlatformPixmap::transformed not properly implemented"); #if 0 QPainter p(&pm); p.setRenderHint(QPainter::Antialiasing); @@ -709,7 +709,7 @@ QPixmap QMacPixmapData::transformed(const QTransform &transform, if (!qt_xForm_helper(mat, 0, QT_XFORM_TYPE_MSBFIRST, bpp, (uchar*)dptr, xbpl, (pm->bytesPerRow) - xbpl, h, (uchar*)sptr, (bytesPerRow), ws, hs)) { - qWarning("QMacPixmapData::transform(): failure"); + qWarning("QMacPlatformPixmap::transform(): failure"); return QPixmap(); } } @@ -984,27 +984,27 @@ Qt::HANDLE QPixmap::macCGHandle() const if (isNull()) return 0; - if (data->classId() == QPixmapData::MacClass) { - QMacPixmapData *d = static_cast(data.data()); + if (data->classId() == QPlatformPixmap::MacClass) { + QMacPlatformPixmap *d = static_cast(data.data()); if (!d->cg_data) d->macCreateCGImageRef(); CGImageRef ret = d->cg_data; CGImageRetain(ret); return ret; - } else if (data->classId() == QPixmapData::RasterClass) { - return qt_mac_image_to_cgimage(static_cast(data.data())->image); + } else if (data->classId() == QPlatformPixmap::RasterClass) { + return qt_mac_image_to_cgimage(static_cast(data.data())->image); } return 0; } -bool QMacPixmapData::hasAlphaChannel() const +bool QMacPlatformPixmap::hasAlphaChannel() const { return has_alpha; } CGImageRef qt_mac_create_imagemask(const QPixmap &pixmap, const QRectF &sr) { - QMacPixmapData *px = static_cast(pixmap.data.data()); + QMacPlatformPixmap *px = static_cast(pixmap.data.data()); if (px->cg_mask) { if (px->cg_mask_rect == sr) { CGImageRetain(px->cg_mask); //reference for the caller @@ -1114,23 +1114,23 @@ IconRef qt_mac_create_iconref(const QPixmap &px) #endif /*! \internal */ -QPaintEngine* QMacPixmapData::paintEngine() const +QPaintEngine* QMacPlatformPixmap::paintEngine() const { if (!pengine) { - QMacPixmapData *that = const_cast(this); + QMacPlatformPixmap *that = const_cast(this); that->pengine = new QCoreGraphicsPaintEngine(); } return pengine; } -void QMacPixmapData::copy(const QPixmapData *data, const QRect &rect) +void QMacPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) { if (data->pixelType() == BitmapType) { QBitmap::fromImage(toImage().copy(rect)); return; } - const QMacPixmapData *macData = static_cast(data); + const QMacPlatformPixmap *macData = static_cast(data); resize(rect.width(), rect.height()); @@ -1152,7 +1152,7 @@ void QMacPixmapData::copy(const QPixmapData *data, const QRect &rect) has_mask = macData->has_mask; } -bool QMacPixmapData::scroll(int dx, int dy, const QRect &rect) +bool QMacPlatformPixmap::scroll(int dx, int dy, const QRect &rect) { Q_UNUSED(dx); Q_UNUSED(dy); diff --git a/src/widgets/platforms/mac/qpixmap_mac_p.h b/src/widgets/platforms/mac/qpixmap_mac_p.h index 3a5d97dc4a..4f53160074 100644 --- a/src/widgets/platforms/mac/qpixmap_mac_p.h +++ b/src/widgets/platforms/mac/qpixmap_mac_p.h @@ -53,23 +53,23 @@ // We mean it. // -#include -#include +#include +#include #include QT_BEGIN_NAMESPACE -class QMacPixmapData : public QPixmapData +class QMacPlatformPixmap : public QPlatformPixmap { public: - QMacPixmapData(PixelType type); - ~QMacPixmapData(); + QMacPlatformPixmap(PixelType type); + ~QMacPlatformPixmap(); - QPixmapData *createCompatiblePixmapData() const; + QPlatformPixmap *createCompatiblePlatformPixmap() const; void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); - void copy(const QPixmapData *data, const QRect &rect); + void copy(const QPlatformPixmap *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); int metric(QPaintDevice::PaintDeviceMetric metric) const; @@ -89,8 +89,8 @@ private: uint has_alpha : 1, has_mask : 1, uninit : 1; void macSetHasAlpha(bool b); - void macGetAlphaChannel(QMacPixmapData *, bool asMask) const; - void macSetAlphaChannel(const QMacPixmapData *, bool asMask); + void macGetAlphaChannel(QMacPlatformPixmap *, bool asMask) const; + void macSetAlphaChannel(const QMacPlatformPixmap *, bool asMask); void macCreateCGImageRef(); void macCreatePixels(); void macReleaseCGImageRef(); @@ -112,7 +112,7 @@ private: uint bytesPerRow; QRectF cg_mask_rect; CGImageRef cg_data, cg_dataBeingReleased, cg_mask; - static QSet validDataPointers; + static QSet validDataPointers; QPaintEngine *pengine; diff --git a/src/widgets/platforms/s60/qapplication_s60.cpp b/src/widgets/platforms/s60/qapplication_s60.cpp index f0739cdd9f..69d321dd65 100644 --- a/src/widgets/platforms/s60/qapplication_s60.cpp +++ b/src/widgets/platforms/s60/qapplication_s60.cpp @@ -1905,7 +1905,7 @@ void qt_cleanup() qt_S60Beep = 0; } QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles - QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles + QPixmapCache::clear(); // Has to happen now, since QS60PlatformPixmap has FBS handles #ifdef QT_NO_FREETYPE qt_cleanup_symbianFontDatabase(); diff --git a/src/widgets/platforms/s60/qpaintengine_s60.cpp b/src/widgets/platforms/s60/qpaintengine_s60.cpp index 091e2e65a4..67984008ca 100644 --- a/src/widgets/platforms/s60/qpaintengine_s60.cpp +++ b/src/widgets/platforms/s60/qpaintengine_s60.cpp @@ -51,8 +51,8 @@ public: QS60PaintEnginePrivate() {} }; -QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PixmapData *data) - : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), pixmapData(data) +QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PlatformPixmap *data) + : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), handle(data) { } @@ -60,11 +60,11 @@ bool QS60PaintEngine::begin(QPaintDevice *device) { Q_D(QS60PaintEngine); - if (pixmapData->classId() == QPixmapData::RasterClass) { - pixmapData->beginDataAccess(); + if (handle->classId() == QPlatformPixmap::RasterClass) { + handle->beginDataAccess(); bool ret = QRasterPaintEngine::begin(device); // Make sure QPaintEngine::paintDevice() returns the proper device. - // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPixmapData + // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPlatformPixmap // which is incorrect in Symbian. d->pdev = device; return ret; @@ -75,9 +75,9 @@ bool QS60PaintEngine::begin(QPaintDevice *device) bool QS60PaintEngine::end() { - if (pixmapData->classId() == QPixmapData::RasterClass) { + if (handle->classId() == QPlatformPixmap::RasterClass) { bool ret = QRasterPaintEngine::end(); - pixmapData->endDataAccess(); + handle->endDataAccess(); return ret; } return QRasterPaintEngine::end(); @@ -85,13 +85,13 @@ bool QS60PaintEngine::end() void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { - if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast(pm.pixmapData()); + if (pm.handle()->classId() == QPlatformPixmap::RasterClass) { + QS60PlatformPixmap *srcData = static_cast(pm.handle()); srcData->beginDataAccess(); QRasterPaintEngine::drawPixmap(p, pm); srcData->endDataAccess(); } else { - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); + void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); if (nativeData) { QVolatileImage *img = static_cast(nativeData); img->beginDataAccess(); @@ -105,13 +105,13 @@ void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { - if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast(pm.pixmapData()); + if (pm.handle()->classId() == QPlatformPixmap::RasterClass) { + QS60PlatformPixmap *srcData = static_cast(pm.handle()); srcData->beginDataAccess(); QRasterPaintEngine::drawPixmap(r, pm, sr); srcData->endDataAccess(); } else { - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); + void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); if (nativeData) { QVolatileImage *img = static_cast(nativeData); img->beginDataAccess(); @@ -125,8 +125,8 @@ void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRect void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) { - if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast(pm.pixmapData()); + if (pm.handle()->classId() == QPlatformPixmap::RasterClass) { + QS60PlatformPixmap *srcData = static_cast(pm.handle()); srcData->beginDataAccess(); QRasterPaintEngine::drawTiledPixmap(r, pm, sr); srcData->endDataAccess(); diff --git a/src/widgets/platforms/s60/qpaintengine_s60_p.h b/src/widgets/platforms/s60/qpaintengine_s60_p.h index 2a3b443db3..4cea87954f 100644 --- a/src/widgets/platforms/s60/qpaintengine_s60_p.h +++ b/src/widgets/platforms/s60/qpaintengine_s60_p.h @@ -58,14 +58,14 @@ QT_BEGIN_NAMESPACE class QS60PaintEnginePrivate; -class QS60PixmapData; +class QS60PlatformPixmap; class QS60PaintEngine : public QRasterPaintEngine { Q_DECLARE_PRIVATE(QS60PaintEngine) public: - QS60PaintEngine(QPaintDevice *device, QS60PixmapData* data); + QS60PaintEngine(QPaintDevice *device, QS60PlatformPixmap* data); bool begin(QPaintDevice *device); bool end(); @@ -76,7 +76,7 @@ public: void prepare(QImage* image); private: - QS60PixmapData *pixmapData; + QS60PlatformPixmap *handle; }; QT_END_NAMESPACE diff --git a/src/widgets/platforms/s60/qpixmap_s60.cpp b/src/widgets/platforms/s60/qpixmap_s60.cpp index ac29f5dea4..5e1474546e 100644 --- a/src/widgets/platforms/s60/qpixmap_s60.cpp +++ b/src/widgets/platforms/s60/qpixmap_s60.cpp @@ -65,10 +65,10 @@ 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 QS60PlatformPixmap *firstPixmap = 0; // static -void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd) +void QS60PlatformPixmap::qt_symbian_register_pixmap(QS60PlatformPixmap *pd) { if (!cleanup_function_registered) { qAddPostRoutine(qt_symbian_release_pixmaps); @@ -83,7 +83,7 @@ void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd) } // static -void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd) +void QS60PlatformPixmap::qt_symbian_unregister_pixmap(QS60PlatformPixmap *pd) { if (pd->next) pd->next->prev = pd->prev; @@ -94,10 +94,10 @@ void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd) } // static -void QS60PixmapData::qt_symbian_release_pixmaps() +void QS60PlatformPixmap::qt_symbian_release_pixmaps() { - // Scan all QS60PixmapData objects in the system and destroy them. - QS60PixmapData *pd = firstPixmap; + // Scan all QS60PlatformPixmap objects in the system and destroy them. + QS60PlatformPixmap *pd = firstPixmap; while (pd != 0) { pd->release(); pd = pd->next; @@ -358,11 +358,11 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h) */ CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const { - QPixmapData *data = pixmapData(); + QPlatformPixmap *data = handle(); if (!data || data->isNull()) return 0; - return reinterpret_cast(data->toNativeType(QPixmapData::FbsBitmap)); + return reinterpret_cast(data->toNativeType(QPlatformPixmap::FbsBitmap)); } /*! @@ -387,13 +387,13 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) if (!bitmap) return QPixmap(); - QScopedPointer data(QPixmapData::create(0,0, QPixmapData::PixmapType)); - data->fromNativeType(reinterpret_cast(bitmap), QPixmapData::FbsBitmap); + QScopedPointer data(QPlatformPixmap::create(0,0, QPlatformPixmap::PixmapType)); + data->fromNativeType(reinterpret_cast(bitmap), QPlatformPixmap::FbsBitmap); QPixmap pixmap(data.take()); return pixmap; } -QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), +QS60PlatformPixmap::QS60PlatformPixmap(PixelType type) : QRasterPlatformPixmap(type), symbianBitmapDataAccess(new QSymbianBitmapDataAccess), cfbsBitmap(0), pengine(0), @@ -405,14 +405,14 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), qt_symbian_register_pixmap(this); } -QS60PixmapData::~QS60PixmapData() +QS60PlatformPixmap::~QS60PlatformPixmap() { release(); delete symbianBitmapDataAccess; qt_symbian_unregister_pixmap(this); } -void QS60PixmapData::resize(int width, int height) +void QS60PlatformPixmap::resize(int width, int height) { if (width <= 0 || height <= 0) { w = width; @@ -446,7 +446,7 @@ void QS60PixmapData::resize(int width, int height) } } -void QS60PixmapData::release() +void QS60PlatformPixmap::release() { if (cfbsBitmap) { QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); @@ -464,7 +464,7 @@ void QS60PixmapData::release() /*! * Takes ownership of bitmap. Used by window surface */ -void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) +void QS60PlatformPixmap::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) { Q_ASSERT(bitmap); @@ -496,9 +496,9 @@ void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) } } -QImage QS60PixmapData::toImage(const QRect &r) const +QImage QS60PlatformPixmap::toImage(const QRect &r) const { - QS60PixmapData *that = const_cast(this); + QS60PlatformPixmap *that = const_cast(this); that->beginDataAccess(); QImage copy = that->image.copy(r); that->endDataAccess(); @@ -506,7 +506,7 @@ QImage QS60PixmapData::toImage(const QRect &r) const return copy; } -void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) +void QS60PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { release(); @@ -588,21 +588,21 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags } } -void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect) +void QS60PlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) { - const QS60PixmapData *s60Data = static_cast(data); + const QS60PlatformPixmap *s60Data = static_cast(data); fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither); } -bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) +bool QS60PlatformPixmap::scroll(int dx, int dy, const QRect &rect) { beginDataAccess(); - bool res = QRasterPixmapData::scroll(dx, dy, rect); + bool res = QRasterPlatformPixmap::scroll(dx, dy, rect); endDataAccess(); return res; } -int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +int QS60PlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const { if (!cfbsBitmap) return 0; @@ -633,7 +633,7 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const } -void QS60PixmapData::fill(const QColor &color) +void QS60PlatformPixmap::fill(const QColor &color) { if (color.alpha() != 255) { QImage im(width(), height(), QImage::Format_ARGB32_Premultiplied); @@ -642,12 +642,12 @@ void QS60PixmapData::fill(const QColor &color) fromImage(im, Qt::AutoColor | Qt::OrderedAlphaDither); } else { beginDataAccess(); - QRasterPixmapData::fill(color); + QRasterPlatformPixmap::fill(color); endDataAccess(); } } -void QS60PixmapData::setMask(const QBitmap &mask) +void QS60PlatformPixmap::setMask(const QBitmap &mask) { if (mask.size().isEmpty()) { if (image.depth() != 1) { @@ -657,7 +657,7 @@ void QS60PixmapData::setMask(const QBitmap &mask) } } else if (image.depth() == 1) { beginDataAccess(); - QRasterPixmapData::setMask(mask); + QRasterPlatformPixmap::setMask(mask); endDataAccess(); } else { const int w = image.width(); @@ -678,7 +678,7 @@ void QS60PixmapData::setMask(const QBitmap &mask) } } -void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel) +void QS60PlatformPixmap::setAlphaChannel(const QPixmap &alphaChannel) { QImage img(toImage()); img.setAlphaChannel(alphaChannel.toImage()); @@ -686,21 +686,21 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel) fromImage(img, Qt::OrderedDither | Qt::OrderedAlphaDither); } -QImage QS60PixmapData::toImage() const +QImage QS60PlatformPixmap::toImage() const { return toImage(QRect()); } -QPaintEngine* QS60PixmapData::paintEngine() const +QPaintEngine* QS60PlatformPixmap::paintEngine() const { if (!pengine) { - QS60PixmapData *that = const_cast(this); + QS60PlatformPixmap *that = const_cast(this); that->pengine = new QS60PaintEngine(&that->image, that); } return pengine; } -void QS60PixmapData::beginDataAccess() +void QS60PlatformPixmap::beginDataAccess() { if(!cfbsBitmap) return; @@ -745,7 +745,7 @@ void QS60PixmapData::beginDataAccess() } } -void QS60PixmapData::endDataAccess(bool readOnly) const +void QS60PlatformPixmap::endDataAccess(bool readOnly) const { Q_UNUSED(readOnly); @@ -778,8 +778,8 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) if (!sgImage) return QPixmap(); - QScopedPointer data(QPixmapData::create(0,0, QPixmapData::PixmapType)); - data->fromNativeType(reinterpret_cast(sgImage), QPixmapData::SgImage); + QScopedPointer data(QPlatformPixmap::create(0,0, QPlatformPixmap::PixmapType)); + data->fromNativeType(reinterpret_cast(sgImage), QPlatformPixmap::SgImage); QPixmap pixmap(data.take()); return pixmap; } @@ -807,16 +807,16 @@ RSgImage *QPixmap::toSymbianRSgImage() const if (isNull()) return 0; - RSgImage *sgImage = reinterpret_cast(pixmapData()->toNativeType(QPixmapData::SgImage)); + RSgImage *sgImage = reinterpret_cast(handle()->toNativeType(QPlatformPixmap::SgImage)); return sgImage; } -void* QS60PixmapData::toNativeType(NativeType type) +void* QS60PlatformPixmap::toNativeType(NativeType type) { - if (type == QPixmapData::SgImage) { + if (type == QPlatformPixmap::SgImage) { return 0; - } else if (type == QPixmapData::FbsBitmap) { + } else if (type == QPlatformPixmap::FbsBitmap) { if (isNull() || !cfbsBitmap) return 0; @@ -895,11 +895,11 @@ void* QS60PixmapData::toNativeType(NativeType type) return 0; } -void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) +void QS60PlatformPixmap::fromNativeType(void* pixmap, NativeType nativeType) { - if (nativeType == QPixmapData::SgImage) { + if (nativeType == QPlatformPixmap::SgImage) { return; - } else if (nativeType == QPixmapData::FbsBitmap && pixmap) { + } else if (nativeType == QPlatformPixmap::FbsBitmap && pixmap) { CFbsBitmap *bitmap = reinterpret_cast(pixmap); @@ -955,8 +955,8 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) type = (format != QImage::Format_MonoLSB) - ? QPixmapData::PixmapType - : QPixmapData::BitmapType; + ? QPlatformPixmap::PixmapType + : QPlatformPixmap::BitmapType; if (needsCopy) { @@ -1005,7 +1005,7 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) } } -void QS60PixmapData::convertToDisplayMode(int mode) +void QS60PlatformPixmap::convertToDisplayMode(int mode) { const TDisplayMode displayMode = static_cast(mode); if (!cfbsBitmap || cfbsBitmap->DisplayMode() == displayMode) @@ -1032,9 +1032,9 @@ void QS60PixmapData::convertToDisplayMode(int mode) UPDATE_BUFFER(); } -QPixmapData *QS60PixmapData::createCompatiblePixmapData() const +QPlatformPixmap *QS60PlatformPixmap::createCompatiblePlatformPixmap() const { - return new QS60PixmapData(pixelType()); + return new QS60PlatformPixmap(pixelType()); } QT_END_NAMESPACE diff --git a/src/widgets/platforms/s60/qpixmap_s60_p.h b/src/widgets/platforms/s60/qpixmap_s60_p.h index e48154963b..2f282e9498 100644 --- a/src/widgets/platforms/s60/qpixmap_s60_p.h +++ b/src/widgets/platforms/s60/qpixmap_s60_p.h @@ -81,17 +81,17 @@ private: bool wasLocked; }; -class QS60PixmapData : public QRasterPixmapData +class QS60PlatformPixmap : public QRasterPlatformPixmap { public: - QS60PixmapData(PixelType type); - ~QS60PixmapData(); + QS60PlatformPixmap(PixelType type); + ~QS60PlatformPixmap(); - QPixmapData *createCompatiblePixmapData() const; + QPlatformPixmap *createCompatiblePlatformPixmap() const; void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); - void copy(const QPixmapData *data, const QRect &rect); + void copy(const QPlatformPixmap *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); int metric(QPaintDevice::PaintDeviceMetric metric) const; @@ -122,11 +122,11 @@ private: bool formatLocked; - QS60PixmapData *next; - QS60PixmapData *prev; + QS60PlatformPixmap *next; + QS60PlatformPixmap *prev; - static void qt_symbian_register_pixmap(QS60PixmapData *pd); - static void qt_symbian_unregister_pixmap(QS60PixmapData *pd); + static void qt_symbian_register_pixmap(QS60PlatformPixmap *pd); + static void qt_symbian_unregister_pixmap(QS60PlatformPixmap *pd); static void qt_symbian_release_pixmaps(); friend class QPixmap; diff --git a/src/widgets/platforms/win/qpixmap_win.cpp b/src/widgets/platforms/win/qpixmap_win.cpp index 0aaf30b8fd..c5adb48f5d 100644 --- a/src/widgets/platforms/win/qpixmap_win.cpp +++ b/src/widgets/platforms/win/qpixmap_win.cpp @@ -125,8 +125,8 @@ HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const return 0; HBITMAP bitmap = 0; - if (data->classId() == QPixmapData::RasterClass) { - QRasterPixmapData* d = static_cast(data.data()); + if (data->classId() == QPlatformPixmap::RasterClass) { + QRasterPlatformPixmap* d = static_cast(data.data()); int w = d->image.width(); int h = d->image.height(); @@ -168,8 +168,8 @@ HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const memcpy(pixels + y * bytes_per_line, image.scanLine(y), bytes_per_line); } else { - QPixmapData *data = new QRasterPixmapData(depth() == 1 ? - QPixmapData::BitmapType : QPixmapData::PixmapType); + QPlatformPixmap *data = new QRasterPlatformPixmap(depth() == 1 ? + QPlatformPixmap::BitmapType : QPlatformPixmap::PixmapType); data->fromImage(toImage(), Qt::AutoColor); return QPixmap(data).toWinHBITMAP(format); } diff --git a/src/widgets/platforms/x11/qcursor_x11.cpp b/src/widgets/platforms/x11/qcursor_x11.cpp index 167e8f8517..1132d3737d 100644 --- a/src/widgets/platforms/x11/qcursor_x11.cpp +++ b/src/widgets/platforms/x11/qcursor_x11.cpp @@ -539,8 +539,8 @@ void QCursorData::update() fg.green = 0; fg.blue = 0; QImage image = QApplicationPrivate::instance()->getPixmapCursor(cshape).toImage(); - pm = QX11PixmapData::createBitmapFromImage(image); - pmm = QX11PixmapData::createBitmapFromImage(image.createAlphaMask().convertToFormat(QImage::Format_MonoLSB)); + pm = QX11PlatformPixmap::createBitmapFromImage(image); + pmm = QX11PlatformPixmap::createBitmapFromImage(image.createAlphaMask().convertToFormat(QImage::Format_MonoLSB)); hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8); } diff --git a/src/widgets/platforms/x11/qfontengine_x11.cpp b/src/widgets/platforms/x11/qfontengine_x11.cpp index c23fb0c174..be421976fa 100644 --- a/src/widgets/platforms/x11/qfontengine_x11.cpp +++ b/src/widgets/platforms/x11/qfontengine_x11.cpp @@ -641,7 +641,7 @@ QBitmap QFontEngineXLFD::bitmapForGlyphs(const QGlyphLayout &glyphs, const glyph if (w <= 0 || h <= 0) return QBitmap(); - QPixmapData *data = new QX11PixmapData(QPixmapData::BitmapType); + QPlatformPixmap *data = new QX11PlatformPixmap(QPlatformPixmap::BitmapType); data->resize(w, h); QPixmap bm(data); QPainter p(&bm); diff --git a/src/widgets/platforms/x11/qpaintengine_x11.cpp b/src/widgets/platforms/x11/qpaintengine_x11.cpp index 6b480815cf..3cb3e3caf7 100644 --- a/src/widgets/platforms/x11/qpaintengine_x11.cpp +++ b/src/widgets/platforms/x11/qpaintengine_x11.cpp @@ -487,7 +487,7 @@ bool QX11PaintEngine::begin(QPaintDevice *pdev) d->picture = (::Picture)w->x11PictureHandle(); } else if (pdev->devType() == QInternal::Pixmap) { const QPixmap *pm = static_cast(pdev); - QX11PixmapData *data = static_cast(pm->data.data()); + QX11PlatformPixmap *data = static_cast(pm->data.data()); if (X11->use_xrender && data->depth() != 32 && data->x11_mask) data->convertToARGB32(); d->picture = (::Picture)static_cast(pdev)->x11PictureHandle(); @@ -1370,7 +1370,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) XRenderPictureAttributes attrs; attrs.repeat = true; XRenderChangePicture(d->dpy, d->brush_pm.x11PictureHandle(), CPRepeat, &attrs); - QX11PixmapData *data = static_cast(d->brush_pm.data.data()); + QX11PlatformPixmap *data = static_cast(d->brush_pm.data.data()); if (data->mask_picture) XRenderChangePicture(d->dpy, data->mask_picture, CPRepeat, &attrs); } @@ -1408,13 +1408,13 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) #ifndef QT_NO_XRENDER if (d->pdev_depth == 32 && d->brush_pm.depth() != 32) { d->brush_pm.detach(); - QX11PixmapData *brushData = static_cast(d->brush_pm.data.data()); + QX11PlatformPixmap *brushData = static_cast(d->brush_pm.data.data()); brushData->convertToARGB32(); } #endif vals.tile = (d->brush_pm.depth() == d->pdev_depth ? d->brush_pm.handle() - : static_cast(d->brush_pm.data.data())->x11ConvertToDefaultDepth()); + : static_cast(d->brush_pm.data.data())->x11ConvertToDefaultDepth()); s = FillTiled; #if !defined(QT_NO_XRENDER) d->current_brush = d->cbrush.texture().x11PictureHandle(); @@ -1925,7 +1925,7 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect QPixmap::x11SetDefaultScreen(pixmap.x11Info().screen()); #ifndef QT_NO_XRENDER - ::Picture src_pict = static_cast(pixmap.data.data())->picture; + ::Picture src_pict = static_cast(pixmap.data.data())->picture; if (src_pict && d->picture) { const int pDepth = pixmap.depth(); if (pDepth == 1 && (d->has_alpha_pen)) { @@ -1944,7 +1944,7 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect bool mono_dst = d->pdev_depth == 1; bool restore_clip = false; - if (static_cast(pixmap.data.data())->x11_mask) { // pixmap has a mask + if (static_cast(pixmap.data.data())->x11_mask) { // pixmap has a mask QBitmap comb(sw, sh); GC cgc = XCreateGC(d->dpy, comb.handle(), 0, 0); XSetForeground(d->dpy, cgc, 0); @@ -1961,7 +1961,7 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect XSetFillStyle(d->dpy, cgc, FillOpaqueStippled); XSetTSOrigin(d->dpy, cgc, -sx, -sy); XSetStipple(d->dpy, cgc, - static_cast(pixmap.data.data())->x11_mask); + static_cast(pixmap.data.data())->x11_mask); XFillRectangle(d->dpy, comb.handle(), cgc, 0, 0, sw, sh); XFreeGC(d->dpy, cgc); @@ -2007,8 +2007,8 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect if (d->pdev->devType() == QInternal::Pixmap) { const QPixmap *px = static_cast(d->pdev); - Pixmap src_mask = static_cast(pixmap.data.data())->x11_mask; - Pixmap dst_mask = static_cast(px->data.data())->x11_mask; + Pixmap src_mask = static_cast(pixmap.data.data())->x11_mask; + Pixmap dst_mask = static_cast(px->data.data())->x11_mask; if (dst_mask) { GC cgc = XCreateGC(d->dpy, dst_mask, 0, 0); if (src_mask) { // copy src mask into dst mask @@ -2222,7 +2222,7 @@ void QX11PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, co #endif } else #endif // !QT_NO_XRENDER - if (pixmap.depth() > 1 && !static_cast(pixmap.data.data())->x11_mask) { + if (pixmap.depth() > 1 && !static_cast(pixmap.data.data())->x11_mask) { XSetTile(d->dpy, d->gc, pixmap.handle()); XSetFillStyle(d->dpy, d->gc, FillTiled); XSetTSOrigin(d->dpy, d->gc, x-sx, y-sy); @@ -2358,7 +2358,7 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti) const bool xrenderPath = (X11->use_xrender && !(d->pdev->devType() == QInternal::Pixmap - && static_cast(d->pdev)->data->pixelType() == QPixmapData::BitmapType)); + && static_cast(d->pdev)->data->pixelType() == QPlatformPixmap::BitmapType)); QVarLengthArray positions; QVarLengthArray glyphs; diff --git a/src/widgets/platforms/x11/qpixmap_x11.cpp b/src/widgets/platforms/x11/qpixmap_x11.cpp index 89f5b0926f..500d1e3ddf 100644 --- a/src/widgets/platforms/x11/qpixmap_x11.cpp +++ b/src/widgets/platforms/x11/qpixmap_x11.cpp @@ -80,10 +80,10 @@ QT_BEGIN_NAMESPACE QPixmap qt_toX11Pixmap(const QImage &image) { - QPixmapData *data = - new QX11PixmapData(image.depth() == 1 - ? QPixmapData::BitmapType - : QPixmapData::PixmapType); + QPlatformPixmap *data = + new QX11PlatformPixmap(image.depth() == 1 + ? QPlatformPixmap::BitmapType + : QPlatformPixmap::PixmapType); data->fromImage(image, Qt::AutoColor); @@ -95,7 +95,7 @@ QPixmap qt_toX11Pixmap(const QPixmap &pixmap) if (pixmap.isNull()) return QPixmap(); - if (QPixmap(pixmap).data_ptr()->classId() == QPixmapData::X11Class) + if (QPixmap(pixmap).data_ptr()->classId() == QPlatformPixmap::X11Class) return pixmap; return qt_toX11Pixmap(pixmap.toImage()); @@ -113,7 +113,7 @@ inline static void qSafeXDestroyImage(XImage *x) XDestroyImage(x); } -QBitmap QX11PixmapData::mask_to_bitmap(int screen) const +QBitmap QX11PlatformPixmap::mask_to_bitmap(int screen) const { if (!x11_mask) return QBitmap(); @@ -126,7 +126,7 @@ QBitmap QX11PixmapData::mask_to_bitmap(int screen) const return bm; } -Qt::HANDLE QX11PixmapData::bitmap_to_mask(const QBitmap &bitmap, int screen) +Qt::HANDLE QX11PlatformPixmap::bitmap_to_mask(const QBitmap &bitmap, int screen) { if (bitmap.isNull()) return 0; @@ -313,19 +313,19 @@ static int defaultScreen = -1; QBasicAtomicInt qt_pixmap_serial = Q_BASIC_ATOMIC_INITIALIZER(0); int Q_WIDGETS_EXPORT qt_x11_preferred_pixmap_depth = 0; -QX11PixmapData::QX11PixmapData(PixelType type) - : QPixmapData(type, X11Class), gl_surface(0), hd(0), +QX11PlatformPixmap::QX11PlatformPixmap(PixelType type) + : QPlatformPixmap(type, X11Class), gl_surface(0), hd(0), flags(Uninitialized), x11_mask(0), picture(0), mask_picture(0), hd2(0), share_mode(QPixmap::ImplicitlyShared), pengine(0) { } -QPixmapData *QX11PixmapData::createCompatiblePixmapData() const +QPlatformPixmap *QX11PlatformPixmap::createCompatiblePlatformPixmap() const { - return new QX11PixmapData(pixelType()); + return new QX11PlatformPixmap(pixelType()); } -void QX11PixmapData::resize(int width, int height) +void QX11PlatformPixmap::resize(int width, int height) { setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); @@ -407,7 +407,7 @@ struct QX11AlphaDetector mutable bool has; }; -void QX11PixmapData::fromImage(const QImage &img, +void QX11PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); @@ -1142,7 +1142,7 @@ void QX11PixmapData::fromImage(const QImage &img, } } -Qt::HANDLE QX11PixmapData::createBitmapFromImage(const QImage &image) +Qt::HANDLE QX11PlatformPixmap::createBitmapFromImage(const QImage &image) { QImage img = image.convertToFormat(QImage::Format_MonoLSB); const QRgb c0 = QColor(Qt::black).rgb(); @@ -1183,7 +1183,7 @@ Qt::HANDLE QX11PixmapData::createBitmapFromImage(const QImage &image) return hd; } -void QX11PixmapData::bitmapFromImage(const QImage &image) +void QX11PlatformPixmap::bitmapFromImage(const QImage &image) { w = image.width(); h = image.height(); @@ -1197,7 +1197,7 @@ void QX11PixmapData::bitmapFromImage(const QImage &image) #endif // QT_NO_XRENDER } -void QX11PixmapData::fill(const QColor &fillColor) +void QX11PlatformPixmap::fill(const QColor &fillColor) { if (fillColor.alpha() != 255) { #ifndef QT_NO_XRENDER @@ -1233,18 +1233,18 @@ void QX11PixmapData::fill(const QColor &fillColor) XFreeGC(X11->display, gc); } -QX11PixmapData::~QX11PixmapData() +QX11PlatformPixmap::~QX11PlatformPixmap() { // Cleanup hooks have to be called before the handles are freed if (is_cached) { - QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(this); + QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(this); is_cached = false; } release(); } -void QX11PixmapData::release() +void QX11PlatformPixmap::release() { delete pengine; pengine = 0; @@ -1283,7 +1283,7 @@ void QX11PixmapData::release() } } -QPixmap QX11PixmapData::alphaChannel() const +QPixmap QX11PlatformPixmap::alphaChannel() const { if (!hasAlphaChannel()) { QPixmap pm(w, h); @@ -1294,7 +1294,7 @@ QPixmap QX11PixmapData::alphaChannel() const return QPixmap::fromImage(im.alphaChannel(), Qt::OrderedDither); } -void QX11PixmapData::setAlphaChannel(const QPixmap &alpha) +void QX11PlatformPixmap::setAlphaChannel(const QPixmap &alpha) { QImage image(toImage()); image.setAlphaChannel(alpha.toImage()); @@ -1303,7 +1303,7 @@ void QX11PixmapData::setAlphaChannel(const QPixmap &alpha) } -QBitmap QX11PixmapData::mask() const +QBitmap QX11PlatformPixmap::mask() const { QBitmap mask; #ifndef QT_NO_XRENDER @@ -1313,7 +1313,7 @@ QBitmap QX11PixmapData::mask() const } else #endif if (d == 1) { - QX11PixmapData *that = const_cast(this); + QX11PlatformPixmap *that = const_cast(this); mask = QPixmap(that); } else { mask = mask_to_bitmap(xinfo.screen()); @@ -1342,12 +1342,12 @@ QBitmap QX11PixmapData::mask() const \sa mask(), {QPixmap#Pixmap Transformations}{Pixmap Transformations}, QBitmap */ -void QX11PixmapData::setMask(const QBitmap &newmask) +void QX11PlatformPixmap::setMask(const QBitmap &newmask) { if (newmask.isNull()) { // clear mask #ifndef QT_NO_XRENDER if (picture && d == 32) { - QX11PixmapData newData(pixelType()); + QX11PlatformPixmap newData(pixelType()); newData.resize(w, h); newData.fill(Qt::black); XRenderComposite(X11->display, PictOpOver, @@ -1355,11 +1355,11 @@ void QX11PixmapData::setMask(const QBitmap &newmask) 0, 0, 0, 0, 0, 0, w, h); release(); *this = newData; - // the new QX11PixmapData object isn't referenced yet, so + // the new QX11PlatformPixmap object isn't referenced yet, so // ref it ref.ref(); - // the below is to make sure the QX11PixmapData destructor + // the below is to make sure the QX11PlatformPixmap destructor // doesn't delete our newly created render picture newData.hd = 0; newData.x11_mask = 0; @@ -1409,7 +1409,7 @@ void QX11PixmapData::setMask(const QBitmap &newmask) XRenderFreePicture(X11->display, mask_picture); #endif } - x11_mask = QX11PixmapData::bitmap_to_mask(newmask, xinfo.screen()); + x11_mask = QX11PlatformPixmap::bitmap_to_mask(newmask, xinfo.screen()); #ifndef QT_NO_XRENDER if (picture) { mask_picture = XRenderCreatePicture(X11->display, x11_mask, @@ -1422,7 +1422,7 @@ void QX11PixmapData::setMask(const QBitmap &newmask) } } -int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +int QX11PlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const { switch (metric) { case QPaintDevice::PdmWidth: @@ -1452,7 +1452,7 @@ int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmPhysicalDpiY: return QX11Info::appDpiY(xinfo.screen()); default: - qWarning("QX11PixmapData::metric(): Invalid metric"); + qWarning("QX11PlatformPixmap::metric(): Invalid metric"); return 0; } } @@ -1462,7 +1462,7 @@ struct QXImageWrapper XImage *xi; }; -bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) const +bool QX11PlatformPixmap::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) const { XImage *xi = xiWrapper.xi; @@ -1485,7 +1485,7 @@ bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) co return false; } -QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) const +QImage QX11PlatformPixmap::takeQImageFromXImage(const QXImageWrapper &xiWrapper) const { XImage *xi = xiWrapper.xi; @@ -1538,7 +1538,7 @@ QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) con return image; } -QImage QX11PixmapData::toImage(const QRect &rect) const +QImage QX11PlatformPixmap::toImage(const QRect &rect) const { QXImageWrapper xiWrapper; xiWrapper.xi = XGetImage(X11->display, hd, rect.x(), rect.y(), rect.width(), rect.height(), @@ -1571,12 +1571,12 @@ QImage QX11PixmapData::toImage(const QRect &rect) const \sa fromImage(), {QImage#Image Formats}{Image Formats} */ -QImage QX11PixmapData::toImage() const +QImage QX11PlatformPixmap::toImage() const { return toImage(QRect(0, 0, w, h)); } -QImage QX11PixmapData::toImage(const QXImageWrapper &xiWrapper, const QRect &rect) const +QImage QX11PlatformPixmap::toImage(const QXImageWrapper &xiWrapper, const QRect &rect) const { XImage *xi = xiWrapper.xi; @@ -1852,7 +1852,7 @@ QImage QX11PixmapData::toImage(const QXImageWrapper &xiWrapper, const QRect &rec \sa trueMatrix(), {QPixmap#Pixmap Transformations}{Pixmap Transformations} */ -QPixmap QX11PixmapData::transformed(const QTransform &transform, +QPixmap QX11PlatformPixmap::transformed(const QTransform &transform, Qt::TransformationMode mode ) const { if (mode == Qt::SmoothTransformation || transform.type() >= QTransform::TxProject) { @@ -2002,9 +2002,9 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, free(dptr); return bm; } else { // color pixmap - QX11PixmapData *x11Data = new QX11PixmapData(QPixmapData::PixmapType); + QX11PlatformPixmap *x11Data = new QX11PlatformPixmap(QPlatformPixmap::PixmapType); QPixmap pm(x11Data); - x11Data->flags &= ~QX11PixmapData::Uninitialized; + x11Data->flags &= ~QX11PlatformPixmap::Uninitialized; x11Data->xinfo = xinfo; x11Data->d = d; x11Data->w = w; @@ -2067,13 +2067,13 @@ void QPixmap::x11SetScreen(int screen) if (isNull()) return; - if (data->classId() != QPixmapData::X11Class) + if (data->classId() != QPlatformPixmap::X11Class) return; if (screen < 0) screen = QX11Info::appScreen(); - QX11PixmapData *x11Data = static_cast(data.data()); + QX11PlatformPixmap *x11Data = static_cast(data.data()); if (screen == x11Data->xinfo.screen()) return; // nothing to do @@ -2142,7 +2142,7 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) window_attr = root_attr; } - QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); + QX11PlatformPixmap *data = new QX11PlatformPixmap(QPlatformPixmap::PixmapType); void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const XWindowAttributes &a); qt_x11_getX11InfoForWindow(&data->xinfo,window_attr); @@ -2151,7 +2151,7 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) QPixmap pm(data); - data->flags &= ~QX11PixmapData::Uninitialized; + data->flags &= ~QX11PlatformPixmap::Uninitialized; pm.x11SetScreen(scr); GC gc = XCreateGC(dpy, pm.handle(), 0, 0); @@ -2162,15 +2162,15 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) return pm; } -bool QX11PixmapData::hasAlphaChannel() const +bool QX11PlatformPixmap::hasAlphaChannel() const { return d == 32; } const QX11Info &QPixmap::x11Info() const { - if (data && data->classId() == QPixmapData::X11Class) - return static_cast(data.data())->xinfo; + if (data && data->classId() == QPlatformPixmap::X11Class) + return static_cast(data.data())->xinfo; else { static QX11Info nullX11Info; return nullX11Info; @@ -2189,9 +2189,9 @@ static XRenderPictFormat *qt_renderformat_for_depth(const QX11Info &xinfo, int d } #endif -QPaintEngine* QX11PixmapData::paintEngine() const +QPaintEngine* QX11PlatformPixmap::paintEngine() const { - QX11PixmapData *that = const_cast(this); + QX11PlatformPixmap *that = const_cast(this); if ((flags & Readonly) && share_mode == QPixmap::ImplicitlyShared) { // if someone wants to draw onto us, copy the shared contents @@ -2215,7 +2215,7 @@ QPaintEngine* QX11PixmapData::paintEngine() const XFreeGC(X11->display, gc); } that->hd = hd_copy; - that->flags &= ~QX11PixmapData::Readonly; + that->flags &= ~QX11PlatformPixmap::Readonly; } if (!that->pengine) @@ -2226,8 +2226,8 @@ QPaintEngine* QX11PixmapData::paintEngine() const Qt::HANDLE QPixmap::x11PictureHandle() const { #ifndef QT_NO_XRENDER - if (data && data->classId() == QPixmapData::X11Class) - return static_cast(data.data())->picture; + if (data && data->classId() == QPlatformPixmap::X11Class) + return static_cast(data.data())->picture; else return 0; #else @@ -2235,7 +2235,7 @@ Qt::HANDLE QPixmap::x11PictureHandle() const #endif // QT_NO_XRENDER } -Qt::HANDLE QX11PixmapData::x11ConvertToDefaultDepth() +Qt::HANDLE QX11PlatformPixmap::x11ConvertToDefaultDepth() { #ifndef QT_NO_XRENDER if (d == QX11Info::appDepth() || !X11->use_xrender) @@ -2255,14 +2255,14 @@ Qt::HANDLE QX11PixmapData::x11ConvertToDefaultDepth() #endif } -void QX11PixmapData::copy(const QPixmapData *data, const QRect &rect) +void QX11PlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) { if (data->pixelType() == BitmapType) { fromImage(data->toImage().copy(rect), Qt::AutoColor); return; } - const QX11PixmapData *x11Data = static_cast(data); + const QX11PlatformPixmap *x11Data = static_cast(data); setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); @@ -2317,7 +2317,7 @@ void QX11PixmapData::copy(const QPixmapData *data, const QRect &rect) } } -bool QX11PixmapData::scroll(int dx, int dy, const QRect &rect) +bool QX11PlatformPixmap::scroll(int dx, int dy, const QRect &rect) { GC gc = XCreateGC(X11->display, hd, 0, 0); XCopyArea(X11->display, hd, hd, gc, @@ -2328,7 +2328,7 @@ bool QX11PixmapData::scroll(int dx, int dy, const QRect &rect) } #if !defined(QT_NO_XRENDER) -void QX11PixmapData::convertToARGB32(bool preserveContents) +void QX11PlatformPixmap::convertToARGB32(bool preserveContents) { if (!X11->use_xrender) return; @@ -2383,9 +2383,9 @@ QPixmap QPixmap::fromX11Pixmap(Qt::HANDLE pixmap, QPixmap::ShareMode mode) break; } - QX11PixmapData *data = new QX11PixmapData(depth == 1 ? QPixmapData::BitmapType : QPixmapData::PixmapType); + QX11PlatformPixmap *data = new QX11PlatformPixmap(depth == 1 ? QPlatformPixmap::BitmapType : QPlatformPixmap::PixmapType); data->setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); - data->flags = QX11PixmapData::Readonly; + data->flags = QX11PlatformPixmap::Readonly; data->share_mode = mode; data->w = width; data->h = height; diff --git a/src/widgets/platforms/x11/qpixmap_x11_p.h b/src/widgets/platforms/x11/qpixmap_x11_p.h index 8c8ccd156c..fce32cbe3e 100644 --- a/src/widgets/platforms/x11/qpixmap_x11_p.h +++ b/src/widgets/platforms/x11/qpixmap_x11_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include -#include +#include +#include #include "QtGui/qx11info_x11.h" @@ -64,20 +64,20 @@ class QX11PaintEngine; struct QXImageWrapper; -class Q_WIDGETS_EXPORT QX11PixmapData : public QPixmapData +class Q_WIDGETS_EXPORT QX11PlatformPixmap : public QPlatformPixmap { public: - QX11PixmapData(PixelType type); -// QX11PixmapData(PixelType type, int width, int height); -// QX11PixmapData(PixelType type, const QImage &image, + QX11PlatformPixmap(PixelType type); +// QX11PlatformPixmap(PixelType type, int width, int height); +// QX11PlatformPixmap(PixelType type, const QImage &image, // Qt::ImageConversionFlags flags); - ~QX11PixmapData(); + ~QX11PlatformPixmap(); - QPixmapData *createCompatiblePixmapData() const; + QPlatformPixmap *createCompatiblePlatformPixmap() const; void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); - void copy(const QPixmapData *data, const QRect &rect); + void copy(const QPlatformPixmap *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); void fill(const QColor &color); @@ -114,9 +114,9 @@ private: friend class QGLContextPrivate; // Needs to access xinfo, gl_surface & flags friend class QEglContext; // Needs gl_surface friend class QGLContext; // Needs gl_surface - friend class QX11GLPixmapData; // Needs gl_surface - friend class QMeeGoLivePixmapData; // Needs gl_surface and flags - friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs gl_surface + friend class QX11GLPlatformPixmap; // Needs gl_surface + friend class QMeeGoLivePlatformPixmap; // Needs gl_surface and flags + friend bool qt_createEGLSurfaceForPixmap(QPlatformPixmap*, bool); // Needs gl_surface void release(); diff --git a/src/widgets/platforms/x11/qwidget_x11.cpp b/src/widgets/platforms/x11/qwidget_x11.cpp index cd4b7b4e15..5bb59b26c9 100644 --- a/src/widgets/platforms/x11/qwidget_x11.cpp +++ b/src/widgets/platforms/x11/qwidget_x11.cpp @@ -1400,7 +1400,7 @@ void QWidgetPrivate::updateSystemBackground() else if (brush.style() == Qt::TexturePattern) { extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap); // qpixmap_x11.cpp XSetWindowBackgroundPixmap(X11->display, q->internalWinId(), - static_cast(qt_toX11Pixmap(brush.texture()).data.data())->x11ConvertToDefaultDepth()); + static_cast(qt_toX11Pixmap(brush.texture()).data.data())->x11ConvertToDefaultDepth()); } else XSetWindowBackground(X11->display, q->internalWinId(), QColormap::instance(xinfo.screen()).pixel(brush.color())); @@ -1546,7 +1546,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) // violates the ICCCM), since this works on all DEs known to Qt if (!forceReset || !topData->iconPixmap) topData->iconPixmap = new QPixmap(qt_toX11Pixmap(icon.pixmap(QSize(64,64)))); - pixmap_handle = static_cast(topData->iconPixmap->data.data())->x11ConvertToDefaultDepth(); + pixmap_handle = static_cast(topData->iconPixmap->data.data())->x11ConvertToDefaultDepth(); } } } diff --git a/src/widgets/platforms/x11/qx11info_x11.h b/src/widgets/platforms/x11/qx11info_x11.h index ac2c36e175..60cd0e9e92 100644 --- a/src/widgets/platforms/x11/qx11info_x11.h +++ b/src/widgets/platforms/x11/qx11info_x11.h @@ -106,7 +106,7 @@ protected: friend class QX11PaintEngine; friend class QPixmap; - friend class QX11PixmapData; + friend class QX11PlatformPixmap; friend class QWidget; friend class QWidgetPrivate; friend class QGLWidget; diff --git a/src/widgets/styles/qs60style_s60.cpp b/src/widgets/styles/qs60style_s60.cpp index f272ff4a90..f7ced9e8f8 100644 --- a/src/widgets/styles/qs60style_s60.cpp +++ b/src/widgets/styles/qs60style_s60.cpp @@ -647,17 +647,17 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask return QPixmap(); QPixmap pixmap; - QScopedPointer pd(QPixmapData::create(0, 0, QPixmapData::PixmapType)); + QScopedPointer pd(QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType)); if (mask) { // Try the efficient path with less copying and conversion. QVolatileImage img(icon, mask); - pd->fromNativeType(&img, QPixmapData::VolatileImage); + pd->fromNativeType(&img, QPlatformPixmap::VolatileImage); if (!pd->isNull()) pixmap = QPixmap(pd.take()); } if (pixmap.isNull()) { // Potentially more expensive path. - pd->fromNativeType(icon, QPixmapData::FbsBitmap); + pd->fromNativeType(icon, QPlatformPixmap::FbsBitmap); pixmap = QPixmap(pd.take()); if (mask) { pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask)); -- cgit v1.2.3