Rename QPixmapData to QPlatformPixmap.

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 <qt_sanity_bot@ovi.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
Samuel Rødal 2011-07-15 14:07:12 +02:00 committed by Jørgen Lind
parent 5abf4f55b1
commit 310519d6d1
92 changed files with 639 additions and 823 deletions

View File

@ -86,7 +86,7 @@ ArthurFrame::ArthurFrame(QWidget *parent)
#ifdef Q_WS_X11 #ifdef Q_WS_X11
QPixmap xRenderPixmap(1, 1); QPixmap xRenderPixmap(1, 1);
m_prefer_image = xRenderPixmap.pixmapData()->classId() == QPixmapData::X11Class && !xRenderPixmap.x11PictureHandle(); m_prefer_image = xRenderPixmap.handle()->classId() == QPlatformPixmap::X11Class && !xRenderPixmap.x11PictureHandle();
#endif #endif
} }

View File

@ -43,7 +43,7 @@
#include <QtGui/private/qt_x11_p.h> #include <QtGui/private/qt_x11_p.h>
#include <QtGui/qx11info_x11.h> #include <QtGui/qx11info_x11.h>
#include <QtGui/private/qpixmapdata_p.h> #include <QtGui/qplatformpixmap_qpa.h>
#include <QtGui/private/qpixmap_x11_p.h> #include <QtGui/private/qpixmap_x11_p.h>
#include <QtGui/private/qimagepixmapcleanuphooks_p.h> #include <QtGui/private/qimagepixmapcleanuphooks_p.h>
@ -339,14 +339,14 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg
return EGL_NO_SURFACE; return EGL_NO_SURFACE;
} }
QX11PixmapData *x11PixmapData = 0; QX11PlatformPixmap *x11PlatformPixmap = 0;
if (devType == QInternal::Pixmap) { if (devType == QInternal::Pixmap) {
QPixmapData *pmd = static_cast<QPixmap*>(device)->data_ptr().data(); QPlatformPixmap *pmd = static_cast<QPixmap*>(device)->data_ptr().data();
if (pmd->classId() == QPixmapData::X11Class) if (pmd->classId() == QPlatformPixmap::X11Class)
x11PixmapData = static_cast<QX11PixmapData*>(pmd); x11PlatformPixmap = static_cast<QX11PlatformPixmap*>(pmd);
else { else {
// TODO: Replace the pixmap's data with a new QX11PixmapData // TODO: Replace the pixmap's data with a new QX11PlatformPixmap
qWarning("WARNING: Creating an EGL surface on a QPixmap is only supported for QX11PixmapData"); qWarning("WARNING: Creating an EGL surface on a QPixmap is only supported for QX11PlatformPixmap");
return EGL_NO_SURFACE; return EGL_NO_SURFACE;
} }
} else if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) { } else if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) {
@ -426,11 +426,11 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg
return surf; return surf;
} }
if (x11PixmapData) { if (x11PlatformPixmap) {
// X11 Pixmaps are only created with a depth, so that's all we need to check // X11 Pixmaps are only created with a depth, so that's all we need to check
EGLint configDepth; EGLint configDepth;
eglGetConfigAttrib(QEgl::display(), config, EGL_BUFFER_SIZE , &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 // 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 // this pixmap. So we need to replace the pixmap's existing data with a new
// one which is created with the correct depth: // 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 #ifndef QT_NO_XRENDER
if (configDepth == 32) { if (configDepth == 32) {
qWarning("Warning: EGLConfig's depth (32) != pixmap's depth (%d), converting to ARGB32", qWarning("Warning: EGLConfig's depth (32) != pixmap's depth (%d), converting to ARGB32",
x11PixmapData->depth()); x11PlatformPixmap->depth());
x11PixmapData->convertToARGB32(true); x11PlatformPixmap->convertToARGB32(true);
} else } else
#endif #endif
{ {
qWarning("Warning: EGLConfig's depth (%d) != pixmap's depth (%d)", 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); surfaceAttribs.setValue(EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB);
EGLSurface surf = eglCreatePixmapSurface(QEgl::display(), config, EGLSurface surf = eglCreatePixmapSurface(QEgl::display(), config,
(EGLNativePixmapType) x11PixmapData->handle(), (EGLNativePixmapType) x11PlatformPixmap->handle(),
surfaceAttribs.properties()); surfaceAttribs.properties());
x11PixmapData->gl_surface = (void*)surf; x11PlatformPixmap->gl_surface = (void*)surf;
QImagePixmapCleanupHooks::enableCleanupHooks(x11PixmapData); QImagePixmapCleanupHooks::enableCleanupHooks(x11PlatformPixmap);
return surf; return surf;
} }

View File

@ -109,7 +109,7 @@ private:
static void setCurrentContext(QEgl::API api, QEglContext *context); static void setCurrentContext(QEgl::API api, QEglContext *context);
friend class QMeeGoGraphicsSystem; friend class QMeeGoGraphicsSystem;
friend class QMeeGoPixmapData; friend class QMeeGoPlatformPixmap;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -21,8 +21,7 @@ HEADERS += \
image/qpixmap_blitter_p.h \ image/qpixmap_blitter_p.h \
image/qpixmapcache.h \ image/qpixmapcache.h \
image/qpixmapcache_p.h \ image/qpixmapcache_p.h \
image/qpixmapdata_p.h \ image/qplatformpixmap_qpa.h \
image/qpixmapdatafactory_p.h \
image/qimagepixmapcleanuphooks_p.h \ image/qimagepixmapcleanuphooks_p.h \
image/qvolatileimage_p.h \ image/qvolatileimage_p.h \
image/qvolatileimagedata_p.h \ image/qvolatileimagedata_p.h \
@ -39,8 +38,7 @@ SOURCES += \
image/qpictureformatplugin.cpp \ image/qpictureformatplugin.cpp \
image/qpixmap.cpp \ image/qpixmap.cpp \
image/qpixmapcache.cpp \ image/qpixmapcache.cpp \
image/qpixmapdata.cpp \ image/qplatformpixmap.cpp \
image/qpixmapdatafactory.cpp \
image/qmovie.cpp \ image/qmovie.cpp \
image/qpixmap_raster.cpp \ image/qpixmap_raster.cpp \
image/qpixmap_blitter.cpp \ image/qpixmap_blitter.cpp \

View File

@ -40,7 +40,7 @@
****************************************************************************/ ****************************************************************************/
#include "qbitmap.h" #include "qbitmap.h"
#include "qpixmapdata_p.h" #include "qplatformpixmap_qpa.h"
#include "qimage.h" #include "qimage.h"
#include "qvariant.h" #include "qvariant.h"
#include <qpainter.h> #include <qpainter.h>
@ -101,7 +101,7 @@ QT_BEGIN_NAMESPACE
\sa QPixmap::isNull() \sa QPixmap::isNull()
*/ */
QBitmap::QBitmap() 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) 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) 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) 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); load(fileName, format, Qt::MonoOnly);
} }
@ -260,7 +260,7 @@ QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)
img.setColor(1, c0); img.setColor(1, c0);
} }
QScopedPointer<QPixmapData> data(QGuiApplicationPrivate::platformIntegration()->createPixmapData(QPixmapData::BitmapType)); QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::BitmapType));
data->fromImage(img, flags | Qt::MonoOnly); data->fromImage(img, flags | Qt::MonoOnly);
return QPixmap(data.take()); return QPixmap(data.take());

View File

@ -75,7 +75,7 @@ public:
QBitmap transformed(const QMatrix &) const; QBitmap transformed(const QMatrix &) const;
QBitmap transformed(const QTransform &matrix) const; QBitmap transformed(const QTransform &matrix) const;
typedef QExplicitlySharedDataPointer<QPixmapData> DataPtr; typedef QExplicitlySharedDataPointer<QPlatformPixmap> DataPtr;
}; };
Q_DECLARE_SHARED(QBitmap) Q_DECLARE_SHARED(QBitmap)

View File

@ -54,9 +54,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
#include <math.h> #include <math.h>
#include <qplatformpixmap_qpa.h>
#include <private/qdrawhelper_p.h> #include <private/qdrawhelper_p.h>
#include <private/qmemrotate_p.h> #include <private/qmemrotate_p.h>
#include <private/qpixmapdata_p.h>
#include <private/qimagescale_p.h> #include <private/qimagescale_p.h>
#include <private/qsimd_p.h> #include <private/qsimd_p.h>

View File

@ -288,8 +288,8 @@ private:
friend class QWSOnScreenSurface; friend class QWSOnScreenSurface;
QImageData *d; QImageData *d;
friend class QRasterPixmapData; friend class QRasterPlatformPixmap;
friend class QBlittablePixmapData; friend class QBlittablePlatformPixmap;
friend class QPixmapCacheEntry; friend class QPixmapCacheEntry;
friend Q_GUI_EXPORT qint64 qt_image_id(const QImage &image); friend Q_GUI_EXPORT qint64 qt_image_id(const QImage &image);
friend const QVector<QRgb> *qt_image_colortable(const QImage &image); friend const QVector<QRgb> *qt_image_colortable(const QImage &image);

View File

@ -40,7 +40,7 @@
****************************************************************************/ ****************************************************************************/
#include "qimagepixmapcleanuphooks_p.h" #include "qimagepixmapcleanuphooks_p.h"
#include "private/qpixmapdata_p.h" #include "qplatformpixmap_qpa.h"
#include "private/qimage_p.h" #include "private/qimage_p.h"
@ -62,12 +62,12 @@ QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance()
return qt_image_and_pixmap_cleanup_hooks(); 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); pixmapModificationHooks.append(hook);
} }
void QImagePixmapCleanupHooks::addPixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) void QImagePixmapCleanupHooks::addPlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook)
{ {
pixmapDestructionHooks.append(hook); pixmapDestructionHooks.append(hook);
} }
@ -78,12 +78,12 @@ void QImagePixmapCleanupHooks::addImageHook(_qt_image_cleanup_hook_64 hook)
imageHooks.append(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); pixmapModificationHooks.removeAll(hook);
} }
void QImagePixmapCleanupHooks::removePixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) void QImagePixmapCleanupHooks::removePlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook)
{ {
pixmapDestructionHooks.removeAll(hook); pixmapDestructionHooks.removeAll(hook);
} }
@ -93,7 +93,7 @@ void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook)
imageHooks.removeAll(hook); imageHooks.removeAll(hook);
} }
void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* pmd) void QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(QPlatformPixmap* pmd)
{ {
QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
// the global destructor for the pixmap and image hooks might have // 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()); 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(); QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks();
// the global destructor for the pixmap and image hooks might have // 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) void QImagePixmapCleanupHooks::enableCleanupHooks(const QPixmap &pixmap)

View File

@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
typedef void (*_qt_image_cleanup_hook_64)(qint64); 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; class QImagePixmapCleanupHooks;
@ -70,26 +70,26 @@ public:
static void enableCleanupHooks(const QImage &image); static void enableCleanupHooks(const QImage &image);
static void enableCleanupHooks(const QPixmap &pixmap); static void enableCleanupHooks(const QPixmap &pixmap);
static void enableCleanupHooks(QPixmapData *pixmapData); static void enableCleanupHooks(QPlatformPixmap *handle);
static bool isImageCached(const QImage &image); static bool isImageCached(const QImage &image);
static bool isPixmapCached(const QPixmap &pixmap); static bool isPixmapCached(const QPixmap &pixmap);
// Gets called when a pixmap data is about to be modified: // 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: // 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: // Gets called when an image is about to be modified or destroyed:
void addImageHook(_qt_image_cleanup_hook_64); void addImageHook(_qt_image_cleanup_hook_64);
void removePixmapDataModificationHook(_qt_pixmap_cleanup_hook_pmd); void removePlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd);
void removePixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd); void removePlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd);
void removeImageHook(_qt_image_cleanup_hook_64); void removeImageHook(_qt_image_cleanup_hook_64);
static void executePixmapDataModificationHooks(QPixmapData*); static void executePlatformPixmapModificationHooks(QPlatformPixmap*);
static void executePixmapDataDestructionHooks(QPixmapData*); static void executePlatformPixmapDestructionHooks(QPlatformPixmap*);
static void executeImageHooks(qint64 key); static void executeImageHooks(qint64 key);
private: private:

View File

@ -42,7 +42,7 @@
#include <qglobal.h> #include <qglobal.h>
#include "qpixmap.h" #include "qpixmap.h"
#include "qpixmapdata_p.h" #include "qplatformpixmap_qpa.h"
#include "qimagepixmapcleanuphooks_p.h" #include "qimagepixmapcleanuphooks_p.h"
#include "qbitmap.h" #include "qbitmap.h"
@ -95,8 +95,8 @@ static bool qt_pixmap_thread_test()
void QPixmap::init(int w, int h, int type) void QPixmap::init(int w, int h, int type)
{ {
if ((w > 0 && h > 0) || type == QPixmapData::BitmapType) if ((w > 0 && h > 0) || type == QPlatformPixmap::BitmapType)
data = QPixmapData::create(w, h, (QPixmapData::PixelType) type); data = QPlatformPixmap::create(w, h, (QPlatformPixmap::PixelType) type);
else else
data = 0; data = 0;
} }
@ -127,7 +127,7 @@ QPixmap::QPixmap()
: QPaintDevice() : QPaintDevice()
{ {
(void) qt_pixmap_thread_test(); (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() : QPaintDevice()
{ {
if (!qt_pixmap_thread_test()) if (!qt_pixmap_thread_test())
init(0, 0, QPixmapData::PixmapType); init(0, 0, QPlatformPixmap::PixmapType);
else else
init(w, h, QPixmapData::PixmapType); init(w, h, QPlatformPixmap::PixmapType);
} }
/*! /*!
@ -167,9 +167,9 @@ QPixmap::QPixmap(const QSize &size)
: QPaintDevice() : QPaintDevice()
{ {
if (!qt_pixmap_thread_test()) if (!qt_pixmap_thread_test())
init(0, 0, QPixmapData::PixmapType); init(0, 0, QPlatformPixmap::PixmapType);
else 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) QPixmap::QPixmap(const QSize &s, int type)
{ {
if (!qt_pixmap_thread_test()) if (!qt_pixmap_thread_test())
init(0, 0, static_cast<QPixmapData::PixelType>(type)); init(0, 0, static_cast<QPlatformPixmap::PixelType>(type));
else else
init(s.width(), s.height(), static_cast<QPixmapData::PixelType>(type)); init(s.width(), s.height(), static_cast<QPlatformPixmap::PixelType>(type));
} }
/*! /*!
\internal \internal
*/ */
QPixmap::QPixmap(QPixmapData *d) QPixmap::QPixmap(QPlatformPixmap *d)
: QPaintDevice(), data(d) : QPaintDevice(), data(d)
{ {
} }
@ -223,7 +223,7 @@ QPixmap::QPixmap(QPixmapData *d)
QPixmap::QPixmap(const QString& fileName, const char *format, Qt::ImageConversionFlags flags) QPixmap::QPixmap(const QString& fileName, const char *format, Qt::ImageConversionFlags flags)
: QPaintDevice() : QPaintDevice()
{ {
init(0, 0, QPixmapData::PixmapType); init(0, 0, QPlatformPixmap::PixmapType);
if (!qt_pixmap_thread_test()) if (!qt_pixmap_thread_test())
return; return;
@ -240,7 +240,7 @@ QPixmap::QPixmap(const QPixmap &pixmap)
: QPaintDevice() : QPaintDevice()
{ {
if (!qt_pixmap_thread_test()) { if (!qt_pixmap_thread_test()) {
init(0, 0, QPixmapData::PixmapType); init(0, 0, QPlatformPixmap::PixmapType);
return; return;
} }
if (pixmap.paintingActive()) { // make a deep copy if (pixmap.paintingActive()) { // make a deep copy
@ -269,13 +269,13 @@ QPixmap::QPixmap(const QPixmap &pixmap)
QPixmap::QPixmap(const char * const xpm[]) QPixmap::QPixmap(const char * const xpm[])
: QPaintDevice() : QPaintDevice()
{ {
init(0, 0, QPixmapData::PixmapType); init(0, 0, QPlatformPixmap::PixmapType);
if (!xpm) if (!xpm)
return; return;
QImage image(xpm); QImage image(xpm);
if (!image.isNull()) { if (!image.isNull()) {
if (data && data->pixelType() == QPixmapData::BitmapType) if (data && data->pixelType() == QPlatformPixmap::BitmapType)
*this = QBitmap::fromImage(image); *this = QBitmap::fromImage(image);
else else
*this = fromImage(image); *this = fromImage(image);
@ -330,7 +330,7 @@ QPixmap QPixmap::copy(const QRect &rect) const
if (!rect.isEmpty()) if (!rect.isEmpty())
r = r.intersected(rect); r = r.intersected(rect);
QPixmapData *d = data->createCompatiblePixmapData(); QPlatformPixmap *d = data->createCompatiblePlatformPixmap();
d->copy(data.data(), r); d->copy(data.data(), r);
return QPixmap(d); return QPixmap(d);
} }
@ -507,7 +507,7 @@ QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h)
bool QPixmap::isQBitmap() const 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() % info.absoluteFilePath()
% HexString<uint>(info.lastModified().toTime_t()) % HexString<uint>(info.lastModified().toTime_t())
% HexString<quint64>(info.size()) % HexString<quint64>(info.size())
% HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType); % HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType);
// Note: If no extension is provided, we try to match the // Note: If no extension is provided, we try to match the
// file against known plugin extensions // 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)) if (QPixmapCache::find(key, *this))
return true; return true;
QScopedPointer<QPixmapData> tmp(QPixmapData::create(0, 0, data ? data->type : QPixmapData::PixmapType)); QScopedPointer<QPlatformPixmap> tmp(QPlatformPixmap::create(0, 0, data ? data->type : QPlatformPixmap::PixmapType));
if (tmp->fromFile(fileName, format, flags)) { if (tmp->fromFile(fileName, format, flags)) {
data = tmp.take(); data = tmp.take();
QPixmapCache::insert(key, *this); QPixmapCache::insert(key, *this);
@ -827,7 +827,7 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I
return false; return false;
if (!data) if (!data)
data = QPixmapData::create(0, 0, QPixmapData::PixmapType); data = QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType);
return data->fromData(buf, len, format, flags); return data->fromData(buf, len, format, flags);
} }
@ -941,7 +941,7 @@ void QPixmap::fill(const QColor &color)
} else { } else {
// Don't bother to make a copy of the data object, since // Don't bother to make a copy of the data object, since
// it will be filled with new pixel data anyway. // it will be filled with new pixel data anyway.
QPixmapData *d = data->createCompatiblePixmapData(); QPlatformPixmap *d = data->createCompatiblePlatformPixmap();
d->resize(data->width(), data->height()); d->resize(data->width(), data->height());
data = d; data = d;
} }
@ -1704,17 +1704,17 @@ void QPixmap::detach()
if (!data) if (!data)
return; 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. // the actual underlaying runtime pixmap data.
QPixmapData *pd = pixmapData(); QPlatformPixmap *pd = handle();
QPixmapData::ClassId id = pd->classId(); QPlatformPixmap::ClassId id = pd->classId();
if (id == QPixmapData::RasterClass) { if (id == QPlatformPixmap::RasterClass) {
QRasterPixmapData *rasterData = static_cast<QRasterPixmapData*>(pd); QRasterPlatformPixmap *rasterData = static_cast<QRasterPlatformPixmap*>(pd);
rasterData->image.detach(); rasterData->image.detach();
} }
if (data->is_cached && data->ref == 1) if (data->is_cached && data->ref == 1)
QImagePixmapCleanupHooks::executePixmapDataModificationHooks(data.data()); QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(data.data());
if (data->ref != 1) { if (data->ref != 1) {
*this = copy(); *this = copy();
@ -1742,7 +1742,7 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)
if (image.isNull()) if (image.isNull())
return QPixmap(); return QPixmap();
QScopedPointer<QPixmapData> data(QGuiApplicationPrivate::platformIntegration()->createPixmapData(QPixmapData::PixmapType)); QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
data->fromImage(image, flags); data->fromImage(image, flags);
return QPixmap(data.take()); 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) QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags)
{ {
QScopedPointer<QPixmapData> data(QGuiApplicationPrivate::platformIntegration()->createPixmapData(QPixmapData::PixmapType)); QScopedPointer<QPlatformPixmap> data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType));
data->fromImageReader(imageReader, flags); data->fromImageReader(imageReader, flags);
return QPixmap(data.take()); return QPixmap(data.take());
} }
@ -1810,7 +1810,7 @@ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionF
/*! /*!
\internal \internal
*/ */
QPixmapData* QPixmap::pixmapData() const QPlatformPixmap* QPixmap::handle() const
{ {
return data.data(); return data.data();
} }

View File

@ -61,13 +61,13 @@ class QImageReader;
class QColor; class QColor;
class QVariant; class QVariant;
class QX11Info; class QX11Info;
class QPixmapData; class QPlatformPixmap;
class Q_GUI_EXPORT QPixmap : public QPaintDevice class Q_GUI_EXPORT QPixmap : public QPaintDevice
{ {
public: public:
QPixmap(); QPixmap();
explicit QPixmap(QPixmapData *data); explicit QPixmap(QPlatformPixmap *data);
QPixmap(int w, int h); QPixmap(int w, int h);
QPixmap(const QSize &); QPixmap(const QSize &);
QPixmap(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); QPixmap(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
@ -168,7 +168,7 @@ protected:
int metric(PaintDeviceMetric) const; int metric(PaintDeviceMetric) const;
private: private:
QExplicitlySharedDataPointer<QPixmapData> data; QExplicitlySharedDataPointer<QPlatformPixmap> data;
bool doImageIO(QImageWriter *io, int quality) const; bool doImageIO(QImageWriter *io, int quality) const;
@ -176,7 +176,7 @@ private:
void init(int, int, int); void init(int, int, int);
void deref(); void deref();
Q_DUMMY_COMPARISON_OPERATOR(QPixmap) Q_DUMMY_COMPARISON_OPERATOR(QPixmap)
friend class QPixmapData; friend class QPlatformPixmap;
friend class QBitmap; friend class QBitmap;
friend class QPaintDevice; friend class QPaintDevice;
friend class QPainter; friend class QPainter;
@ -188,10 +188,10 @@ private:
#endif #endif
public: public:
QPixmapData* pixmapData() const; QPlatformPixmap* handle() const;
public: public:
typedef QExplicitlySharedDataPointer<QPixmapData> DataPtr; typedef QExplicitlySharedDataPointer<QPlatformPixmap> DataPtr;
inline DataPtr &data_ptr() { return data; } inline DataPtr &data_ptr() { return data; }
}; };

View File

@ -55,8 +55,8 @@ QT_BEGIN_NAMESPACE
static int global_ser_no = 0; static int global_ser_no = 0;
QBlittablePixmapData::QBlittablePixmapData() QBlittablePlatformPixmap::QBlittablePlatformPixmap()
: QPixmapData(QPixmapData::PixmapType,BlitterClass), m_engine(0), m_blittable(0) : QPlatformPixmap(QPlatformPixmap::PixmapType,BlitterClass), m_engine(0), m_blittable(0)
#ifdef QT_BLITTER_RASTEROVERLAY #ifdef QT_BLITTER_RASTEROVERLAY
,m_rasterOverlay(0), m_unmergedCopy(0) ,m_rasterOverlay(0), m_unmergedCopy(0)
#endif //QT_BLITTER_RASTEROVERLAY #endif //QT_BLITTER_RASTEROVERLAY
@ -64,7 +64,7 @@ QBlittablePixmapData::QBlittablePixmapData()
setSerialNumber(++global_ser_no); setSerialNumber(++global_ser_no);
} }
QBlittablePixmapData::~QBlittablePixmapData() QBlittablePlatformPixmap::~QBlittablePlatformPixmap()
{ {
delete m_blittable; delete m_blittable;
delete m_engine; delete m_engine;
@ -74,23 +74,23 @@ QBlittablePixmapData::~QBlittablePixmapData()
#endif //QT_BLITTER_RASTEROVERLAY #endif //QT_BLITTER_RASTEROVERLAY
} }
QBlittable *QBlittablePixmapData::blittable() const QBlittable *QBlittablePlatformPixmap::blittable() const
{ {
if (!m_blittable) { if (!m_blittable) {
QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this); QBlittablePlatformPixmap *that = const_cast<QBlittablePlatformPixmap *>(this);
that->m_blittable = this->createBlittable(QSize(w,h)); that->m_blittable = this->createBlittable(QSize(w,h));
} }
return m_blittable; return m_blittable;
} }
void QBlittablePixmapData::setBlittable(QBlittable *blittable) void QBlittablePlatformPixmap::setBlittable(QBlittable *blittable)
{ {
resize(blittable->size().width(),blittable->size().height()); resize(blittable->size().width(),blittable->size().height());
m_blittable = blittable; m_blittable = blittable;
} }
void QBlittablePixmapData::resize(int width, int height) void QBlittablePlatformPixmap::resize(int width, int height)
{ {
delete m_blittable; delete m_blittable;
@ -105,7 +105,7 @@ void QBlittablePixmapData::resize(int width, int height)
is_null = (w <= 0 || h <= 0); is_null = (w <= 0 || h <= 0);
} }
int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const
{ {
switch (metric) { switch (metric) {
case QPaintDevice::PdmWidth: case QPaintDevice::PdmWidth:
@ -125,14 +125,14 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
case QPaintDevice::PdmPhysicalDpiY: case QPaintDevice::PdmPhysicalDpiY:
return qt_defaultDpiY(); return qt_defaultDpiY();
default: default:
qWarning("QRasterPixmapData::metric(): Unhandled metric type %d", metric); qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric);
break; break;
} }
return 0; return 0;
} }
void QBlittablePixmapData::fill(const QColor &color) void QBlittablePlatformPixmap::fill(const QColor &color)
{ {
//jlind: todo: change when blittables can support non opaque fillRects //jlind: todo: change when blittables can support non opaque fillRects
if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) { 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(); return blittable()->lock();
} }
QImage QBlittablePixmapData::toImage() const QImage QBlittablePlatformPixmap::toImage() const
{ {
return blittable()->lock()->copy(); return blittable()->lock()->copy();
} }
bool QBlittablePixmapData::hasAlphaChannel() const bool QBlittablePlatformPixmap::hasAlphaChannel() const
{ {
return blittable()->lock()->hasAlphaChannel(); return blittable()->lock()->hasAlphaChannel();
} }
void QBlittablePixmapData::fromImage(const QImage &image, void QBlittablePlatformPixmap::fromImage(const QImage &image,
Qt::ImageConversionFlags flags) Qt::ImageConversionFlags flags)
{ {
resize(image.width(),image.height()); 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) { if (!m_engine) {
QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this); QBlittablePlatformPixmap *that = const_cast<QBlittablePlatformPixmap *>(this);
that->m_engine = new QBlitterPaintEngine(that); that->m_engine = new QBlitterPaintEngine(that);
} }
return m_engine; return m_engine;
@ -216,7 +216,7 @@ QPaintEngine *QBlittablePixmapData::paintEngine() const
static bool showRasterOverlay = !qgetenv("QT_BLITTER_RASTEROVERLAY").isEmpty(); static bool showRasterOverlay = !qgetenv("QT_BLITTER_RASTEROVERLAY").isEmpty();
void QBlittablePixmapData::mergeOverlay() void QBlittablePlatformPixmap::mergeOverlay()
{ {
if (m_unmergedCopy || !showRasterOverlay) if (m_unmergedCopy || !showRasterOverlay)
return; return;
@ -227,7 +227,7 @@ void QBlittablePixmapData::mergeOverlay()
p.end(); p.end();
} }
void QBlittablePixmapData::unmergeOverlay() void QBlittablePlatformPixmap::unmergeOverlay()
{ {
if (!m_unmergedCopy || !showRasterOverlay) if (!m_unmergedCopy || !showRasterOverlay)
return; return;
@ -240,7 +240,7 @@ void QBlittablePixmapData::unmergeOverlay()
m_unmergedCopy = 0; m_unmergedCopy = 0;
} }
QImage *QBlittablePixmapData::overlay() QImage *QBlittablePlatformPixmap::overlay()
{ {
if (!m_rasterOverlay|| if (!m_rasterOverlay||
m_rasterOverlay->size() != QSize(w,h)){ m_rasterOverlay->size() != QSize(w,h)){
@ -254,7 +254,7 @@ QImage *QBlittablePixmapData::overlay()
return m_rasterOverlay; return m_rasterOverlay;
} }
void QBlittablePixmapData::markRasterOverlayImpl(const QRectF &rect) void QBlittablePlatformPixmap::markRasterOverlayImpl(const QRectF &rect)
{ {
if (!showRasterOverlay) if (!showRasterOverlay)
return; 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) if (!showRasterOverlay)
return; 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; QRectF transformationRect = rect;
paintEngine(); paintEngine();

View File

@ -42,18 +42,18 @@
#ifndef QPIXMAP_BLITTER_P_H #ifndef QPIXMAP_BLITTER_P_H
#define QPIXMAP_BLITTER_P_H #define QPIXMAP_BLITTER_P_H
#include <private/qpixmapdata_p.h> #include <qplatformpixmap_qpa.h>
#include <private/qpaintengine_blitter_p.h> #include <private/qpaintengine_blitter_p.h>
#ifndef QT_NO_BLITTABLE #ifndef QT_NO_BLITTABLE
QT_BEGIN_NAMESPACE 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: public:
QBlittablePixmapData(); QBlittablePlatformPixmap();
~QBlittablePixmapData(); ~QBlittablePlatformPixmap();
virtual QBlittable *createBlittable(const QSize &size) const = 0; virtual QBlittable *createBlittable(const QSize &size) const = 0;
QBlittable *blittable() const; 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 #ifdef QT_BLITTER_RASTEROVERLAY
markRasterOverlayImpl(rect); markRasterOverlayImpl(rect);
@ -107,7 +107,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QRectF &rect)
#endif #endif
} }
inline void QBlittablePixmapData::markRasterOverlay(const QVectorPath &path) inline void QBlittablePlatformPixmap::markRasterOverlay(const QVectorPath &path)
{ {
#ifdef QT_BLITTER_RASTEROVERLAY #ifdef QT_BLITTER_RASTEROVERLAY
markRasterOverlayImpl(path.convertToPainterPath().boundingRect()); markRasterOverlayImpl(path.convertToPainterPath().boundingRect());
@ -116,7 +116,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QVectorPath &path)
#endif #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 #ifdef QT_BLITTER_RASTEROVERLAY
QFontMetricsF fm(ti.font()); QFontMetricsF fm(ti.font());
@ -129,7 +129,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QPointF &pos, const QT
#endif #endif
} }
inline void QBlittablePixmapData::markRasterOverlay(const QRect *rects, int rectCount) inline void QBlittablePlatformPixmap::markRasterOverlay(const QRect *rects, int rectCount)
{ {
#ifdef QT_BLITTER_RASTEROVERLAY #ifdef QT_BLITTER_RASTEROVERLAY
for (int i = 0; i < rectCount; i++) { for (int i = 0; i < rectCount; i++) {
@ -140,7 +140,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QRect *rects, int rect
Q_UNUSED(rectCount) Q_UNUSED(rectCount)
#endif #endif
} }
inline void QBlittablePixmapData::markRasterOverlay(const QRectF *rects, int rectCount) inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF *rects, int rectCount)
{ {
#ifdef QT_BLITTER_RASTEROVERLAY #ifdef QT_BLITTER_RASTEROVERLAY
for (int i = 0; i < rectCount; i++) { for (int i = 0; i < rectCount; i++) {
@ -152,7 +152,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QRectF *rects, int rec
#endif #endif
} }
inline void QBlittablePixmapData::unmarkRasterOverlay(const QRectF &rect) inline void QBlittablePlatformPixmap::unmarkRasterOverlay(const QRectF &rect)
{ {
#ifdef QT_BLITTER_RASTEROVERLAY #ifdef QT_BLITTER_RASTEROVERLAY
unmarkRasterOverlayImpl(rect); unmarkRasterOverlayImpl(rect);

View File

@ -60,10 +60,10 @@ QT_BEGIN_NAMESPACE
QPixmap qt_toRasterPixmap(const QImage &image) QPixmap qt_toRasterPixmap(const QImage &image)
{ {
QPixmapData *data = QPlatformPixmap *data =
new QRasterPixmapData(image.depth() == 1 new QRasterPlatformPixmap(image.depth() == 1
? QPixmapData::BitmapType ? QPlatformPixmap::BitmapType
: QPixmapData::PixmapType); : QPlatformPixmap::PixmapType);
data->fromImage(image, Qt::AutoColor); data->fromImage(image, Qt::AutoColor);
@ -75,27 +75,27 @@ QPixmap qt_toRasterPixmap(const QPixmap &pixmap)
if (pixmap.isNull()) if (pixmap.isNull())
return QPixmap(); return QPixmap();
if (QPixmap(pixmap).data_ptr()->classId() == QPixmapData::RasterClass) if (QPixmap(pixmap).data_ptr()->classId() == QPlatformPixmap::RasterClass)
return pixmap; return pixmap;
return qt_toRasterPixmap(pixmap.toImage()); return qt_toRasterPixmap(pixmap.toImage());
} }
QRasterPixmapData::QRasterPixmapData(PixelType type) QRasterPlatformPixmap::QRasterPlatformPixmap(PixelType type)
: QPixmapData(type, RasterClass) : 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; QImage::Format format;
#ifdef Q_WS_QWS #ifdef Q_WS_QWS
@ -130,7 +130,7 @@ void QRasterPixmapData::resize(int width, int height)
setSerialNumber(image.serialNumber()); 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) Qt::ImageConversionFlags flags)
{ {
QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len); QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len);
@ -144,7 +144,7 @@ bool QRasterPixmapData::fromData(const uchar *buffer, uint len, const char *form
return !isNull(); return !isNull();
} }
void QRasterPixmapData::fromImage(const QImage &sourceImage, void QRasterPlatformPixmap::fromImage(const QImage &sourceImage,
Qt::ImageConversionFlags flags) Qt::ImageConversionFlags flags)
{ {
Q_UNUSED(flags); Q_UNUSED(flags);
@ -152,7 +152,7 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage,
createPixmapForImage(image, flags, /* inplace = */false); createPixmapForImage(image, flags, /* inplace = */false);
} }
void QRasterPixmapData::fromImageReader(QImageReader *imageReader, void QRasterPlatformPixmap::fromImageReader(QImageReader *imageReader,
Qt::ImageConversionFlags flags) Qt::ImageConversionFlags flags)
{ {
Q_UNUSED(flags); Q_UNUSED(flags);
@ -166,19 +166,19 @@ void QRasterPixmapData::fromImageReader(QImageReader *imageReader,
// from qwindowsurface.cpp // from qwindowsurface.cpp
extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); 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); 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()) if (!image.isNull())
qt_scrollRectInImage(image, rect, QPoint(dx, dy)); qt_scrollRectInImage(image, rect, QPoint(dx, dy));
return true; return true;
} }
void QRasterPixmapData::fill(const QColor &color) void QRasterPlatformPixmap::fill(const QColor &color)
{ {
uint pixel; uint pixel;
@ -262,12 +262,12 @@ void QRasterPixmapData::fill(const QColor &color)
image.fill(pixel); image.fill(pixel);
} }
bool QRasterPixmapData::hasAlphaChannel() const bool QRasterPlatformPixmap::hasAlphaChannel() const
{ {
return image.hasAlphaChannel(); return image.hasAlphaChannel();
} }
QImage QRasterPixmapData::toImage() const QImage QRasterPlatformPixmap::toImage() const
{ {
if (!image.isNull()) { if (!image.isNull()) {
QImageData *data = const_cast<QImage &>(image).data_ptr(); QImageData *data = const_cast<QImage &>(image).data_ptr();
@ -281,7 +281,7 @@ QImage QRasterPixmapData::toImage() const
return image; return image;
} }
QImage QRasterPixmapData::toImage(const QRect &rect) const QImage QRasterPlatformPixmap::toImage(const QRect &rect) const
{ {
if (rect.isNull()) if (rect.isNull())
return image; return image;
@ -295,12 +295,12 @@ QImage QRasterPixmapData::toImage(const QRect &rect) const
return image.copy(clipped); return image.copy(clipped);
} }
QPaintEngine* QRasterPixmapData::paintEngine() const QPaintEngine* QRasterPlatformPixmap::paintEngine() const
{ {
return image.paintEngine(); return image.paintEngine();
} }
int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const int QRasterPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const
{ {
QImageData *d = image.d; QImageData *d = image.d;
if (!d) if (!d)
@ -327,14 +327,14 @@ int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
case QPaintDevice::PdmPhysicalDpiY: case QPaintDevice::PdmPhysicalDpiY:
return qt_defaultDpiY(); return qt_defaultDpiY();
default: default:
qWarning("QRasterPixmapData::metric(): Unhandled metric type %d", metric); qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric);
break; break;
} }
return 0; 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; QImage::Format format;
if (flags & Qt::NoFormatConversion) if (flags & Qt::NoFormatConversion)
@ -436,7 +436,7 @@ void QRasterPixmapData::createPixmapForImage(QImage &sourceImage, Qt::ImageConve
setSerialNumber(image.serialNumber()); setSerialNumber(image.serialNumber());
} }
QImage* QRasterPixmapData::buffer() QImage* QRasterPlatformPixmap::buffer()
{ {
return &image; return &image;
} }

View File

@ -53,8 +53,7 @@
// We mean it. // We mean it.
// //
#include <QtGui/private/qpixmapdata_p.h> #include <QtGui/qplatformpixmap_qpa.h>
#include <QtGui/private/qpixmapdatafactory_p.h>
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
# include "qt_windows.h" # include "qt_windows.h"
@ -62,13 +61,13 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QRasterPixmapData : public QPixmapData class Q_GUI_EXPORT QRasterPlatformPixmap : public QPlatformPixmap
{ {
public: public:
QRasterPixmapData(PixelType type); QRasterPlatformPixmap(PixelType type);
~QRasterPixmapData(); ~QRasterPlatformPixmap();
QPixmapData *createCompatiblePixmapData() const; QPlatformPixmap *createCompatiblePlatformPixmap() const;
void resize(int width, int height); void resize(int width, int height);
void fromFile(const QString &filename, Qt::ImageConversionFlags flags); void fromFile(const QString &filename, Qt::ImageConversionFlags flags);
@ -76,7 +75,7 @@ public:
void fromImage(const QImage &image, Qt::ImageConversionFlags flags); void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
void fromImageReader(QImageReader *imageReader, 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); bool scroll(int dx, int dy, const QRect &rect);
void fill(const QColor &color); void fill(const QColor &color);
bool hasAlphaChannel() const; bool hasAlphaChannel() const;

View File

@ -81,9 +81,9 @@ class QPixmapCacheEntry : public QPixmap
public: public:
QPixmapCacheEntry(const QPixmapCache::Key &key, const QPixmap &pix) : QPixmap(pix), key(key) QPixmapCacheEntry(const QPixmapCache::Key &key, const QPixmap &pix) : QPixmap(pix), key(key)
{ {
QPixmapData *pd = pixmapData(); QPlatformPixmap *pd = handle();
if (pd && pd->classId() == QPixmapData::RasterClass) { if (pd && pd->classId() == QPlatformPixmap::RasterClass) {
QRasterPixmapData *d = static_cast<QRasterPixmapData*>(pd); QRasterPlatformPixmap *d = static_cast<QRasterPlatformPixmap*>(pd);
if (!d->image.isNull() && d->image.d->paintEngine if (!d->image.isNull() && d->image.d->paintEngine
&& !d->image.d->paintEngine->isActive()) && !d->image.d->paintEngine->isActive())
{ {

View File

@ -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 <QtGui/qscreen_qws.h>
#endif
#ifdef Q_WS_X11
# include <private/qpixmap_x11_p.h>
#endif
#if defined(Q_WS_WIN)
# include <private/qpixmap_raster_p.h>
#endif
#ifdef Q_WS_MAC
# include <private/qpixmap_mac_p.h>
#endif
#ifdef Q_WS_QPA
# include <private/qpixmap_raster_p.h>
#endif
#ifdef Q_OS_SYMBIAN
# include <private/qpixmap_s60_p.h>
#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

View File

@ -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 <QtCore/qstring.h>
#include <QtGui/qimage.h>
#include <QtGui/private/qpixmapdata_p.h>
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

View File

@ -39,7 +39,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qpixmapdata_p.h" #include "qplatformpixmap_qpa.h"
#include <QtCore/qbuffer.h> #include <QtCore/qbuffer.h>
#include <QtGui/qbitmap.h> #include <QtGui/qbitmap.h>
#include <QtGui/qimagereader.h> #include <QtGui/qimagereader.h>
@ -48,15 +48,15 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QPixmapData *QPixmapData::create(int w, int h, PixelType type) QPlatformPixmap *QPlatformPixmap::create(int w, int h, PixelType type)
{ {
QPixmapData *data = QGuiApplicationPrivate::platformIntegration()->createPixmapData(static_cast<QPixmapData::PixelType>(type)); QPlatformPixmap *data = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(static_cast<QPlatformPixmap::PixelType>(type));
data->resize(w, h); data->resize(w, h);
return data; return data;
} }
QPixmapData::QPixmapData(PixelType pixelType, int objectId) QPlatformPixmap::QPlatformPixmap(PixelType pixelType, int objectId)
: w(0), : w(0),
h(0), h(0),
d(0), d(0),
@ -70,29 +70,29 @@ QPixmapData::QPixmapData(PixelType pixelType, int objectId)
{ {
} }
QPixmapData::~QPixmapData() QPlatformPixmap::~QPlatformPixmap()
{ {
// Sometimes the pixmap cleanup hooks will be called from derrived classes, which will // 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 // 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, // 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 // 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 // call the cleanup hooks itself before deleting the native pixmap and set is_cached to
// false. // false.
if (is_cached) { if (is_cached) {
QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(this); QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(this);
is_cached = false; is_cached = false;
} }
} }
QPixmapData *QPixmapData::createCompatiblePixmapData() const QPlatformPixmap *QPlatformPixmap::createCompatiblePlatformPixmap() const
{ {
QPixmapData *d = QGuiApplicationPrivate::platformIntegration()->createPixmapData(pixelType()); QPlatformPixmap *d = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(pixelType());
return d; return d;
} }
static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Qt::ImageConversionFlags flags) static QImage makeBitmapCompliantIfNeeded(QPlatformPixmap *d, const QImage &image, Qt::ImageConversionFlags flags)
{ {
if (d->pixelType() == QPixmapData::BitmapType) { if (d->pixelType() == QPlatformPixmap::BitmapType) {
QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags); QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags);
// make sure image.color(0) == Qt::color0 (white) // make sure image.color(0) == Qt::color0 (white)
@ -110,14 +110,14 @@ static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Q
return image; return image;
} }
void QPixmapData::fromImageReader(QImageReader *imageReader, void QPlatformPixmap::fromImageReader(QImageReader *imageReader,
Qt::ImageConversionFlags flags) Qt::ImageConversionFlags flags)
{ {
const QImage image = imageReader->read(); const QImage image = imageReader->read();
fromImage(image, flags); fromImage(image, flags);
} }
bool QPixmapData::fromFile(const QString &fileName, const char *format, bool QPlatformPixmap::fromFile(const QString &fileName, const char *format,
Qt::ImageConversionFlags flags) Qt::ImageConversionFlags flags)
{ {
QImage image = QImageReader(fileName, format).read(); QImage image = QImageReader(fileName, format).read();
@ -127,7 +127,7 @@ bool QPixmapData::fromFile(const QString &fileName, const char *format,
return !isNull(); return !isNull();
} }
bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) bool QPlatformPixmap::fromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags)
{ {
QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buf), len); QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buf), len);
QBuffer b(&a); QBuffer b(&a);
@ -137,12 +137,12 @@ bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::I
return !isNull(); return !isNull();
} }
void QPixmapData::copy(const QPixmapData *data, const QRect &rect) void QPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect)
{ {
fromImage(data->toImage(rect), Qt::NoOpaqueDetection); fromImage(data->toImage(rect), Qt::NoOpaqueDetection);
} }
bool QPixmapData::scroll(int dx, int dy, const QRect &rect) bool QPlatformPixmap::scroll(int dx, int dy, const QRect &rect)
{ {
Q_UNUSED(dx); Q_UNUSED(dx);
Q_UNUSED(dy); Q_UNUSED(dy);
@ -150,18 +150,18 @@ bool QPixmapData::scroll(int dx, int dy, const QRect &rect)
return false; return false;
} }
QPixmap QPixmapData::transformed(const QTransform &matrix, QPixmap QPlatformPixmap::transformed(const QTransform &matrix,
Qt::TransformationMode mode) const Qt::TransformationMode mode) const
{ {
return QPixmap::fromImage(toImage().transformed(matrix, mode)); return QPixmap::fromImage(toImage().transformed(matrix, mode));
} }
void QPixmapData::setSerialNumber(int serNo) void QPlatformPixmap::setSerialNumber(int serNo)
{ {
ser_no = serNo; ser_no = serNo;
} }
QImage QPixmapData::toImage(const QRect &rect) const QImage QPlatformPixmap::toImage(const QRect &rect) const
{ {
if (rect.contains(QRect(0, 0, w, h))) if (rect.contains(QRect(0, 0, w, h)))
return toImage(); return toImage();
@ -169,18 +169,18 @@ QImage QPixmapData::toImage(const QRect &rect) const
return toImage().copy(rect); return toImage().copy(rect);
} }
QImage* QPixmapData::buffer() QImage* QPlatformPixmap::buffer()
{ {
return 0; return 0;
} }
#if defined(Q_OS_SYMBIAN) #if defined(Q_OS_SYMBIAN)
void* QPixmapData::toNativeType(NativeType /* type */) void* QPlatformPixmap::toNativeType(NativeType /* type */)
{ {
return 0; return 0;
} }
void QPixmapData::fromNativeType(void* /* pixmap */, NativeType /* typre */) void QPlatformPixmap::fromNativeType(void* /* pixmap */, NativeType /* typre */)
{ {
return; return;
} }

View File

@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QImageReader; class QImageReader;
class Q_GUI_EXPORT QPixmapData class Q_GUI_EXPORT QPlatformPixmap
{ {
public: public:
enum PixelType { enum PixelType {
@ -72,10 +72,10 @@ public:
enum ClassId { RasterClass, DirectFBClass, enum ClassId { RasterClass, DirectFBClass,
BlitterClass, CustomClass = 1024 }; BlitterClass, CustomClass = 1024 };
QPixmapData(PixelType pixelType, int classId); QPlatformPixmap(PixelType pixelType, int classId);
virtual ~QPixmapData(); virtual ~QPlatformPixmap();
virtual QPixmapData *createCompatiblePixmapData() const; virtual QPlatformPixmap *createCompatiblePlatformPixmap() const;
virtual void resize(int width, int height) = 0; virtual void resize(int width, int height) = 0;
virtual void fromImage(const QImage &image, virtual void fromImage(const QImage &image,
@ -88,7 +88,7 @@ public:
virtual bool fromData(const uchar *buffer, uint len, const char *format, virtual bool fromData(const uchar *buffer, uint len, const char *format,
Qt::ImageConversionFlags flags); Qt::ImageConversionFlags flags);
virtual void copy(const QPixmapData *data, const QRect &rect); virtual void copy(const QPlatformPixmap *data, const QRect &rect);
virtual bool scroll(int dx, int dy, const QRect &rect); virtual bool scroll(int dx, int dy, const QRect &rect);
virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0; virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0;
@ -123,7 +123,7 @@ public:
| ((qint64) detach_no)); | ((qint64) detach_no));
} }
static QPixmapData *create(int w, int h, PixelType type); static QPlatformPixmap *create(int w, int h, PixelType type);
protected: protected:
@ -137,7 +137,7 @@ private:
friend class QPixmap; friend class QPixmap;
friend class QImagePixmapCleanupHooks; // Needs to set is_cached friend class QImagePixmapCleanupHooks; // Needs to set is_cached
friend class QGLTextureCache; //Needs to check the reference count friend class QGLTextureCache; //Needs to check the reference count
friend class QExplicitlySharedDataPointer<QPixmapData>; friend class QExplicitlySharedDataPointer<QPlatformPixmap>;
QAtomicInt ref; QAtomicInt ref;
int detach_no; int detach_no;

View File

@ -42,7 +42,7 @@
#include "qvolatileimage_p.h" #include "qvolatileimage_p.h"
#include "qvolatileimagedata_p.h" #include "qvolatileimagedata_p.h"
#include <QtGui/private/qpaintengine_raster_p.h> #include <QtGui/private/qpaintengine_raster_p.h>
#include <QtGui/private/qpixmapdata_p.h> #include <QtGui/qplatformpixmap_qpa.h>
QT_BEGIN_NAMESPACE 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() QPaintEngine *QVolatileImage::paintEngine()
{ {
@ -275,7 +275,7 @@ bool QVolatileImagePaintEngine::end()
void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
{ {
#ifdef Q_OS_SYMBIAN #ifdef Q_OS_SYMBIAN
void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage);
if (nativeData) { if (nativeData) {
QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
img->beginDataAccess(); 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) void QVolatileImagePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
{ {
#ifdef Q_OS_SYMBIAN #ifdef Q_OS_SYMBIAN
void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage);
if (nativeData) { if (nativeData) {
QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
img->beginDataAccess(); img->beginDataAccess();

View File

@ -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. Factory function for QPlatformPixmap. PixelType can be either PixmapType or BitmapType.
\sa QPixmapData \sa QPlatformPixmap
*/ */
/*! /*!

View File

@ -43,7 +43,7 @@
#define QPLATFORMINTEGRATION_H #define QPLATFORMINTEGRATION_H
#include <QtGui/qwindowdefs.h> #include <QtGui/qwindowdefs.h>
#include <QtGui/private/qpixmapdata_p.h> #include <QtGui/qplatformpixmap_qpa.h>
#include <QtGui/qplatformscreen_qpa.h> #include <QtGui/qplatformscreen_qpa.h>
#include <QtGui/qsurfaceformat.h> #include <QtGui/qsurfaceformat.h>
@ -79,7 +79,7 @@ public:
virtual bool hasCapability(Capability cap) const; virtual bool hasCapability(Capability cap) const;
// GraphicsSystem functions // 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 QPlatformWindow *createPlatformWindow(QWindow *window) const = 0;
virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const = 0; virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const = 0;
virtual QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &format, QPlatformGLContext *share) const; virtual QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &format, QPlatformGLContext *share) const;

View File

@ -282,7 +282,7 @@ private:
friend class QWin32PaintEnginePrivate; friend class QWin32PaintEnginePrivate;
friend class QMacCGContext; friend class QMacCGContext;
friend class QPreviewPaintEngine; friend class QPreviewPaintEngine;
friend class QX11GLPixmapData; friend class QX11GLPlatformPixmap;
}; };

View File

@ -111,7 +111,7 @@ public:
bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const 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; return false;
if (checkStateAgainstMask(capabillitiesState,drawPixmapMask)) { if (checkStateAgainstMask(capabillitiesState,drawPixmapMask)) {
if (m_capabilities & (QBlittable::SourceOverPixmapCapability if (m_capabilities & (QBlittable::SourceOverPixmapCapability
@ -190,7 +190,7 @@ class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate
{ {
Q_DECLARE_PUBLIC(QBlitterPaintEngine); Q_DECLARE_PUBLIC(QBlitterPaintEngine);
public: public:
QBlitterPaintEnginePrivate(QBlittablePixmapData *p) QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p)
: QPaintEngineExPrivate(), : QPaintEngineExPrivate(),
pmData(p), pmData(p),
isBlitterLocked(false), isBlitterLocked(false),
@ -280,7 +280,7 @@ public:
QRasterPaintEngine *raster; QRasterPaintEngine *raster;
QBlittablePixmapData *pmData; QBlittablePlatformPixmap *pmData;
bool isBlitterLocked; bool isBlitterLocked;
CapabilitiesToStateMask *capabillities; CapabilitiesToStateMask *capabillities;
@ -288,7 +288,7 @@ public:
uint hasXForm; uint hasXForm;
}; };
QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePixmapData *p) QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p)
: QPaintEngineEx(*(new QBlitterPaintEnginePrivate(p))) : QPaintEngineEx(*(new QBlitterPaintEnginePrivate(p)))
{ {
} }

View File

@ -49,14 +49,14 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QBlitterPaintEnginePrivate; class QBlitterPaintEnginePrivate;
class QBlittablePixmapData; class QBlittablePlatformPixmap;
class QBlittable; class QBlittable;
class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx
{ {
Q_DECLARE_PRIVATE(QBlitterPaintEngine); Q_DECLARE_PRIVATE(QBlitterPaintEngine);
public: public:
QBlitterPaintEngine(QBlittablePixmapData *p); QBlitterPaintEngine(QBlittablePlatformPixmap *p);
~QBlitterPaintEngine(); ~QBlitterPaintEngine();
virtual QPainterState *createState(QPainterState *orig) const; virtual QPainterState *createState(QPainterState *orig) const;

View File

@ -438,8 +438,8 @@ bool QRasterPaintEngine::begin(QPaintDevice *device)
if (device->devType() == QInternal::Pixmap) { if (device->devType() == QInternal::Pixmap) {
QPixmap *pixmap = static_cast<QPixmap *>(device); QPixmap *pixmap = static_cast<QPixmap *>(device);
QPixmapData *pd = pixmap->pixmapData(); QPlatformPixmap *pd = pixmap->handle();
if (pd->classId() == QPixmapData::RasterClass || pd->classId() == QPixmapData::BlitterClass) if (pd->classId() == QPlatformPixmap::RasterClass || pd->classId() == QPlatformPixmap::BlitterClass)
d->device = pd->buffer(); d->device = pd->buffer();
} else { } else {
d->device = device; 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(); qDebug() << " - QRasterPaintEngine::drawPixmap(), pos=" << pos << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth();
#endif #endif
QPixmapData *pd = pixmap.pixmapData(); QPlatformPixmap *pd = pixmap.handle();
if (pd->classId() == QPixmapData::RasterClass) { if (pd->classId() == QPlatformPixmap::RasterClass) {
const QImage &image = static_cast<QRasterPixmapData *>(pd)->image; const QImage &image = static_cast<QRasterPlatformPixmap *>(pd)->image;
if (image.depth() == 1) { if (image.depth() == 1) {
Q_D(QRasterPaintEngine); Q_D(QRasterPaintEngine);
QRasterPaintEngineState *s = state(); 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(); qDebug() << " - QRasterPaintEngine::drawPixmap(), r=" << r << " sr=" << sr << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth();
#endif #endif
QPixmapData* pd = pixmap.pixmapData(); QPlatformPixmap* pd = pixmap.handle();
if (pd->classId() == QPixmapData::RasterClass) { if (pd->classId() == QPlatformPixmap::RasterClass) {
const QImage &image = static_cast<QRasterPixmapData *>(pd)->image; const QImage &image = static_cast<QRasterPlatformPixmap *>(pd)->image;
if (image.depth() == 1) { if (image.depth() == 1) {
Q_D(QRasterPaintEngine); Q_D(QRasterPaintEngine);
QRasterPaintEngineState *s = state(); QRasterPaintEngineState *s = state();
@ -2425,9 +2425,9 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap,
QImage image; QImage image;
QPixmapData *pd = pixmap.pixmapData(); QPlatformPixmap *pd = pixmap.handle();
if (pd->classId() == QPixmapData::RasterClass) { if (pd->classId() == QPlatformPixmap::RasterClass) {
image = static_cast<QRasterPixmapData *>(pd)->image; image = static_cast<QRasterPlatformPixmap *>(pd)->image;
} else { } else {
image = pixmap.toImage(); image = pixmap.toImage();
} }

View File

@ -84,7 +84,7 @@
#include <qglframebufferobject.h> #include <qglframebufferobject.h>
#include <private/qimage_p.h> #include <private/qimage_p.h>
#include <private/qpixmapdata_p.h> #include <qplatformpixmap_qpa.h>
#include <private/qglpixelbuffer_p.h> #include <private/qglpixelbuffer_p.h>
#include <private/qimagepixmapcleanuphooks_p.h> #include <private/qimagepixmapcleanuphooks_p.h>
#include "qcolormap.h" #include "qcolormap.h"
@ -1836,15 +1836,15 @@ Q_GLOBAL_STATIC(QGLTextureCache, qt_gl_texture_cache)
QGLTextureCache::QGLTextureCache() QGLTextureCache::QGLTextureCache()
: m_cache(64*1024) // cache ~64 MB worth of textures - this is not accurate though : m_cache(64*1024) // cache ~64 MB worth of textures - this is not accurate though
{ {
QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(cleanupTexturesForPixampData); QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(cleanupTexturesForPixampData);
QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(cleanupBeforePixmapDestruction);
QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey); QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey);
} }
QGLTextureCache::~QGLTextureCache() QGLTextureCache::~QGLTextureCache()
{ {
QImagePixmapCleanupHooks::instance()->removePixmapDataModificationHook(cleanupTexturesForPixampData); QImagePixmapCleanupHooks::instance()->removePlatformPixmapModificationHook(cleanupTexturesForPixampData);
QImagePixmapCleanupHooks::instance()->removePixmapDataDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->removePlatformPixmapDestructionHook(cleanupBeforePixmapDestruction);
QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey); 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()); cleanupTexturesForCacheKey(pmd->cacheKey());
} }
void QGLTextureCache::cleanupBeforePixmapDestruction(QPixmapData* pmd) void QGLTextureCache::cleanupBeforePixmapDestruction(QPlatformPixmap* pmd)
{ {
// Remove any bound textures first: // Remove any bound textures first:
cleanupTexturesForPixampData(pmd); cleanupTexturesForPixampData(pmd);
#if defined(Q_WS_X11) #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 Q_ASSERT(pmd->ref == 0); // Make sure reference counting isn't broken
QGLContextPrivate::destroyGlSurfaceForPixmap(pmd); 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) QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options)
{ {
Q_Q(QGLContext); Q_Q(QGLContext);
QPixmapData *pd = pixmap.pixmapData(); QPlatformPixmap *pd = pixmap.handle();
Q_UNUSED(pd); Q_UNUSED(pd);
const qint64 key = pixmap.cacheKey(); const qint64 key = pixmap.cacheKey();
@ -2601,7 +2601,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target,
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
// Try to use texture_from_pixmap // Try to use texture_from_pixmap
const QX11Info *xinfo = qt_x11Info(paintDevice); 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() && xinfo && xinfo->screen() == pixmap.x11Info().screen()
&& target == GL_TEXTURE_2D && target == GL_TEXTURE_2D
&& QApplication::instance()->thread() == QThread::currentThread()) && 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; int old_depth = qt_x11_preferred_pixmap_depth;
qt_x11_preferred_pixmap_depth = x11Info().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()); data->resize(sz.width(), sz.height());
QPixmap pm(data); QPixmap pm(data);
qt_x11_preferred_pixmap_depth = old_depth; qt_x11_preferred_pixmap_depth = old_depth;

View File

@ -280,16 +280,16 @@ void QGLContextPrivate::destroyEglSurfaceForDevice()
EGLSurface QGLContextPrivate::eglSurfaceForDevice() const 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) if (!paintDevice)
return eglSurface; return eglSurface;
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if (paintDevice->devType() == QInternal::Pixmap) { if (paintDevice->devType() == QInternal::Pixmap) {
QPixmapData *pmd = static_cast<QPixmap*>(paintDevice)->data_ptr().data(); QPlatformPixmap *pmd = static_cast<QPixmap*>(paintDevice)->data_ptr().data();
if (pmd->classId() == QPixmapData::X11Class) { if (pmd->classId() == QPlatformPixmap::X11Class) {
QX11PixmapData* x11PixmapData = static_cast<QX11PixmapData*>(pmd); QX11PlatformPixmap* x11PlatformPixmap = static_cast<QX11PlatformPixmap*>(pmd);
return (EGLSurface)x11PixmapData->gl_surface; return (EGLSurface)x11PlatformPixmap->gl_surface;
} }
} }
#endif #endif

View File

@ -382,11 +382,11 @@ public:
void* pbuf; void* pbuf;
quint32 gpm; quint32 gpm;
int screen; int screen;
QHash<QPixmapData*, QPixmap> boundPixmaps; QHash<QPlatformPixmap*, QPixmap> boundPixmaps;
QGLTexture *bindTextureFromNativePixmap(QPixmap*, const qint64 key, QGLTexture *bindTextureFromNativePixmap(QPixmap*, const qint64 key,
QGLContext::BindOptions options); QGLContext::BindOptions options);
static void destroyGlSurfaceForPixmap(QPixmapData*); static void destroyGlSurfaceForPixmap(QPlatformPixmap*);
static void unbindPixmapFromTexture(QPixmapData*); static void unbindPixmapFromTexture(QPlatformPixmap*);
#endif #endif
#if defined(Q_WS_MAC) #if defined(Q_WS_MAC)
bool update; bool update;
@ -502,18 +502,18 @@ class Q_OPENGL_EXPORT QGLTextureDestroyer : public QObject
public: public:
QGLTextureDestroyer() : QObject() { QGLTextureDestroyer() : QObject() {
qRegisterMetaType<GLuint>("GLuint"); qRegisterMetaType<GLuint>("GLuint");
connect(this, SIGNAL(freeTexture(QGLContext *, QPixmapData *, GLuint)), connect(this, SIGNAL(freeTexture(QGLContext *, QPlatformPixmap *, GLuint)),
this, SLOT(freeTexture_slot(QGLContext *, QPixmapData *, 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); emit freeTexture(context, boundPixmap, id);
} }
Q_SIGNALS: Q_SIGNALS:
void freeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id); void freeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id);
private slots: private slots:
void freeTexture_slot(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { void freeTexture_slot(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) {
Q_UNUSED(boundPixmap); Q_UNUSED(boundPixmap);
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
if (boundPixmap) { if (boundPixmap) {
@ -565,7 +565,7 @@ public:
if (options & QGLContext::MemoryManagedBindOption) { if (options & QGLContext::MemoryManagedBindOption) {
Q_ASSERT(context); Q_ASSERT(context);
#if !defined(Q_WS_X11) #if !defined(Q_WS_X11)
QPixmapData *boundPixmap = 0; QPlatformPixmap *boundPixmap = 0;
#endif #endif
context->d_ptr->texture_destroyer->emitFreeTexture(context, boundPixmap, id); context->d_ptr->texture_destroyer->emitFreeTexture(context, boundPixmap, id);
} }
@ -578,7 +578,7 @@ public:
QGLContext::BindOptions options; QGLContext::BindOptions options;
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
QPixmapData* boundPixmap; QPlatformPixmap* boundPixmap;
#endif #endif
bool canBindCompressedTexture bool canBindCompressedTexture
@ -623,8 +623,8 @@ public:
void removeContextTextures(QGLContext *ctx); void removeContextTextures(QGLContext *ctx);
static QGLTextureCache *instance(); static QGLTextureCache *instance();
static void cleanupTexturesForCacheKey(qint64 cacheKey); static void cleanupTexturesForCacheKey(qint64 cacheKey);
static void cleanupTexturesForPixampData(QPixmapData* pixmap); static void cleanupTexturesForPixampData(QPlatformPixmap* pixmap);
static void cleanupBeforePixmapDestruction(QPixmapData* pixmap); static void cleanupBeforePixmapDestruction(QPlatformPixmap* pixmap);
private: private:
QCache<QGLTextureCacheKey, QGLTexture> m_cache; QCache<QGLTextureCacheKey, QGLTexture> m_cache;

View File

@ -50,7 +50,7 @@
#include <private/qwidget_p.h> // to access QWExtra #include <private/qwidget_p.h> // to access QWExtra
#include <private/qnativeimagehandleprovider_p.h> #include <private/qnativeimagehandleprovider_p.h>
#include "qgl_egl_p.h" #include "qgl_egl_p.h"
#include "qpixmapdata_gl_p.h" #include "qplatformpixmap_gl_p.h"
#include "qgltexturepool_p.h" #include "qgltexturepool_p.h"
#include "qcolormap.h" #include "qcolormap.h"
#include <QDebug> #include <QDebug>
@ -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<CFbsBitmap *>(pixmap); CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap *>(pixmap);
QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight); QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight);
if (size.width() == w && size.height() == h) if (size.width() == w && size.height() == h)
@ -402,7 +402,7 @@ void QGLPixmapData::fromNativeType(void* pixmap, NativeType type)
m_hasFillColor = false; m_hasFillColor = false;
m_dirty = true; m_dirty = true;
} else if (type == QPixmapData::VolatileImage && pixmap) { } else if (type == QPlatformPixmap::VolatileImage && pixmap) {
// Support QS60Style in more efficient skin graphics retrieval. // Support QS60Style in more efficient skin graphics retrieval.
QVolatileImage *img = static_cast<QVolatileImage *>(pixmap); QVolatileImage *img = static_cast<QVolatileImage *>(pixmap);
if (img->width() == w && img->height() == h) if (img->width() == w && img->height() == h)
@ -412,7 +412,7 @@ void QGLPixmapData::fromNativeType(void* pixmap, NativeType type)
m_hasAlpha = m_source.hasAlphaChannel(); m_hasAlpha = m_source.hasAlphaChannel();
m_hasFillColor = false; m_hasFillColor = false;
m_dirty = true; m_dirty = true;
} else if (type == QPixmapData::NativeImageHandleProvider && pixmap) { } else if (type == QPlatformPixmap::NativeImageHandleProvider && pixmap) {
destroyTexture(); destroyTexture();
nativeImageHandleProvider = static_cast<QNativeImageHandleProvider *>(pixmap); nativeImageHandleProvider = static_cast<QNativeImageHandleProvider *>(pixmap);
// Cannot defer the retrieval, we need at least the size right away. // 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()) if (m_source.isNull())
m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied); m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied);
return m_source.duplicateNativeImage(); return m_source.duplicateNativeImage();
@ -431,19 +431,19 @@ void* QGLPixmapData::toNativeType(NativeType type)
return 0; return 0;
} }
bool QGLPixmapData::initFromNativeImageHandle(void *handle, const QString &type) bool QGLPlatformPixmap::initFromNativeImageHandle(void *handle, const QString &type)
{ {
if (type == QLatin1String("RSgImage")) { if (type == QLatin1String("RSgImage")) {
fromNativeType(handle, QPixmapData::SgImage); fromNativeType(handle, QPlatformPixmap::SgImage);
return true; return true;
} else if (type == QLatin1String("CFbsBitmap")) { } else if (type == QLatin1String("CFbsBitmap")) {
fromNativeType(handle, QPixmapData::FbsBitmap); fromNativeType(handle, QPlatformPixmap::FbsBitmap);
return true; return true;
} }
return false; return false;
} }
void QGLPixmapData::createFromNativeImageHandleProvider() void QGLPlatformPixmap::createFromNativeImageHandleProvider()
{ {
void *handle = 0; void *handle = 0;
QString type; QString type;
@ -453,14 +453,14 @@ void QGLPixmapData::createFromNativeImageHandleProvider()
nativeImageHandle = handle; nativeImageHandle = handle;
nativeImageType = type; nativeImageType = type;
} else { } else {
qWarning("QGLPixmapData: Unknown native image type '%s'", qPrintable(type)); qWarning("QGLPlatformPixmap: Unknown native image type '%s'", qPrintable(type));
} }
} else { } else {
qWarning("QGLPixmapData: Native handle is null"); qWarning("QGLPlatformPixmap: Native handle is null");
} }
} }
void QGLPixmapData::releaseNativeImageHandle() void QGLPlatformPixmap::releaseNativeImageHandle()
{ {
if (nativeImageHandleProvider && nativeImageHandle) { if (nativeImageHandleProvider && nativeImageHandle) {
nativeImageHandleProvider->release(nativeImageHandle, nativeImageType); nativeImageHandleProvider->release(nativeImageHandle, nativeImageType);

View File

@ -1769,17 +1769,17 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons
Q_Q(QGLContext); Q_Q(QGLContext);
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data()); QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pixmap->data_ptr().data());
Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); Q_ASSERT(handle->classId() == QPlatformPixmap::X11Class);
// We can't use TFP if the pixmap has a separate X11 mask // We can't use TFP if the pixmap has a separate X11 mask
if (pixmapData->x11_mask) if (handle->x11_mask)
return 0; return 0;
if (!qt_resolveTextureFromPixmap(paintDevice)) if (!qt_resolveTextureFromPixmap(paintDevice))
return 0; 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) // Store the configs (Can be static because configs aren't dependent on current context)
static GLXFBConfig glxRGBPixmapConfig = 0; static GLXFBConfig glxRGBPixmapConfig = 0;
@ -1787,7 +1787,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons
static GLXFBConfig glxRGBAPixmapConfig = 0; static GLXFBConfig glxRGBAPixmapConfig = 0;
static bool RGBAConfigInverted = false; static bool RGBAConfigInverted = false;
bool hasAlpha = pixmapData->hasAlphaChannel(); bool hasAlpha = handle->hasAlphaChannel();
// Check to see if we need a config // Check to see if we need a config
if ( (hasAlpha && !glxRGBAPixmapConfig) || (!hasAlpha && !glxRGBPixmapConfig) ) { if ( (hasAlpha && !glxRGBAPixmapConfig) || (!hasAlpha && !glxRGBPixmapConfig) ) {
@ -1822,15 +1822,15 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons
} }
// Check to see if the surface is still valid // Check to see if the surface is still valid
if (pixmapData->gl_surface && if (handle->gl_surface &&
hasAlpha != (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) hasAlpha != (handle->flags & QX11PlatformPixmap::GlSurfaceCreatedWithAlpha))
{ {
// Surface is invalid! // Surface is invalid!
destroyGlSurfaceForPixmap(pixmapData); destroyGlSurfaceForPixmap(handle);
} }
// Check to see if we need a surface // Check to see if we need a surface
if (!pixmapData->gl_surface) { if (!handle->gl_surface) {
GLXPixmap glxPixmap; GLXPixmap glxPixmap;
int pixmapAttribs[] = { int pixmapAttribs[] = {
GLX_TEXTURE_FORMAT_EXT, hasAlpha ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT, 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: // Wrap the X Pixmap into a GLXPixmap:
glxPixmap = glXCreatePixmap(x11Info.display(), glxPixmap = glXCreatePixmap(x11Info.display(),
hasAlpha ? glxRGBAPixmapConfig : glxRGBPixmapConfig, hasAlpha ? glxRGBAPixmapConfig : glxRGBPixmapConfig,
pixmapData->handle(), pixmapAttribs); handle->handle(), pixmapAttribs);
if (!glxPixmap) if (!glxPixmap)
return 0; 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 // Make sure the cleanup hook gets called so we can delete the glx pixmap
QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); QImagePixmapCleanupHooks::enableCleanupHooks(handle);
} }
GLuint textureId; GLuint textureId;
glGenTextures(1, &textureId); glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, 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); glBindTexture(GL_TEXTURE_2D, textureId);
GLuint filtering = (options & QGLContext::LinearFilteringBindOption) ? GL_LINEAR : GL_NEAREST; 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); QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options);
if (texture->options & QGLContext::InvertedYBindOption) if (texture->options & QGLContext::InvertedYBindOption)
pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; handle->flags |= QX11PlatformPixmap::InvertedWhenBoundToTexture;
// We assume the cost of bound pixmaps is zero // We assume the cost of bound pixmaps is zero
QGLTextureCache::instance()->insert(q, key, texture, 0); 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) #if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX)
Q_ASSERT(pmd->classId() == QPixmapData::X11Class); Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class);
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd); QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pmd);
if (pixmapData->gl_surface) { if (handle->gl_surface) {
glXDestroyPixmap(QX11Info::display(), (GLXPixmap)pixmapData->gl_surface); glXDestroyPixmap(QX11Info::display(), (GLXPixmap)handle->gl_surface);
pixmapData->gl_surface = 0; handle->gl_surface = 0;
} }
#endif #endif
} }
void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd) void QGLContextPrivate::unbindPixmapFromTexture(QPlatformPixmap* pmd)
{ {
#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) #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()); Q_ASSERT(QGLContext::currentContext());
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd); QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pmd);
if (pixmapData->gl_surface) if (handle->gl_surface)
glXReleaseTexImageEXT(QX11Info::display(), (GLXPixmap)pixmapData->gl_surface, GLX_FRONT_LEFT_EXT); glXReleaseTexImageEXT(QX11Info::display(), (GLXPixmap)handle->gl_surface, GLX_FRONT_LEFT_EXT);
#endif #endif
} }

View File

@ -171,13 +171,13 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
int devType = device()->devType(); int devType = device()->devType();
QX11PixmapData *x11PixmapData = 0; QX11PlatformPixmap *x11PlatformPixmap = 0;
if (devType == QInternal::Pixmap) { if (devType == QInternal::Pixmap) {
QPixmapData *pmd = static_cast<QPixmap*>(device())->data_ptr().data(); QPlatformPixmap *pmd = static_cast<QPixmap*>(device())->data_ptr().data();
if (pmd->classId() == QPixmapData::X11Class) if (pmd->classId() == QPlatformPixmap::X11Class)
x11PixmapData = static_cast<QX11PixmapData*>(pmd); x11PlatformPixmap = static_cast<QX11PlatformPixmap*>(pmd);
else { 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"); qWarning("WARNING: Creating a QGLContext on a QPixmap is only supported for X11 pixmap backend");
return false; return false;
} }
@ -234,7 +234,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
// Do don't create the EGLSurface for everything. // Do don't create the EGLSurface for everything.
// QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface
// QGLWidget - 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 // QGLPixelBuffer - no, it creates the surface itself and stores it in QGLPixelBufferPrivate::pbuf
if (devType == QInternal::Widget) { if (devType == QInternal::Widget) {
@ -246,12 +246,12 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
setWindowCreated(true); setWindowCreated(true);
} }
if (x11PixmapData) { if (x11PlatformPixmap) {
// TODO: Actually check to see if the existing surface can be re-used // TODO: Actually check to see if the existing surface can be re-used
if (x11PixmapData->gl_surface) if (x11PlatformPixmap->gl_surface)
eglDestroySurface(d->eglContext->display(), (EGLSurface)x11PixmapData->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; return true;
@ -415,17 +415,17 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons
return 0; return 0;
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data()); QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pixmap->data_ptr().data());
Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); Q_ASSERT(handle->classId() == QPlatformPixmap::X11Class);
bool hasAlpha = pixmapData->hasAlphaChannel(); bool hasAlpha = handle->hasAlphaChannel();
bool pixmapHasValidSurface = false; bool pixmapHasValidSurface = false;
bool textureIsBound = false; bool textureIsBound = false;
GLuint textureId; GLuint textureId;
glGenTextures(1, &textureId); glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId); glBindTexture(GL_TEXTURE_2D, textureId);
if (haveTFP && pixmapData->gl_surface && if (haveTFP && handle->gl_surface &&
hasAlpha == (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) hasAlpha == (handle->flags & QX11PlatformPixmap::GlSurfaceCreatedWithAlpha))
{ {
pixmapHasValidSurface = true; 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 we already have a valid EGL surface for the pixmap, we should use it
if (pixmapHasValidSurface) { if (pixmapHasValidSurface) {
EGLBoolean success; 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) { if (success == EGL_FALSE) {
qWarning() << "eglBindTexImage() failed:" << QEgl::errorString(); qWarning() << "eglBindTexImage() failed:" << QEgl::errorString();
eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); eglDestroySurface(QEgl::display(), (EGLSurface)handle->gl_surface);
pixmapData->gl_surface = (void*)EGL_NO_SURFACE; handle->gl_surface = (void*)EGL_NO_SURFACE;
} else } else
textureIsBound = true; textureIsBound = true;
} }
@ -469,29 +469,29 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons
if (!textureIsBound && haveTFP) { if (!textureIsBound && haveTFP) {
// Check to see if the surface is still valid // Check to see if the surface is still valid
if (pixmapData->gl_surface && if (handle->gl_surface &&
hasAlpha != (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) hasAlpha != (handle->flags & QX11PlatformPixmap::GlSurfaceCreatedWithAlpha))
{ {
// Surface is invalid! // Surface is invalid!
destroyGlSurfaceForPixmap(pixmapData); destroyGlSurfaceForPixmap(handle);
} }
if (pixmapData->gl_surface == 0) { if (handle->gl_surface == 0) {
EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap, EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap,
QEgl::OpenGL, QEgl::OpenGL,
hasAlpha ? QEgl::Translucent : QEgl::NoOptions); hasAlpha ? QEgl::Translucent : QEgl::NoOptions);
pixmapData->gl_surface = (void*)QEgl::createSurface(pixmap, config); handle->gl_surface = (void*)QEgl::createSurface(pixmap, config);
if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE) if (handle->gl_surface == (void*)EGL_NO_SURFACE)
return false; return false;
} }
EGLBoolean success; 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) { if (success == EGL_FALSE) {
qWarning() << "eglBindTexImage() failed:" << QEgl::errorString(); qWarning() << "eglBindTexImage() failed:" << QEgl::errorString();
eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); eglDestroySurface(QEgl::display(), (EGLSurface)handle->gl_surface);
pixmapData->gl_surface = (void*)EGL_NO_SURFACE; handle->gl_surface = (void*)EGL_NO_SURFACE;
haveTFP = false; // If TFP isn't working, disable it's use haveTFP = false; // If TFP isn't working, disable it's use
} else } else
textureIsBound = true; textureIsBound = true;
@ -501,7 +501,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons
if (textureIsBound) { if (textureIsBound) {
texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); 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 // We assume the cost of bound pixmaps is zero
QGLTextureCache::instance()->insert(q, key, texture, 0); 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); Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class);
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd); QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pmd);
if (pixmapData->gl_surface) { if (handle->gl_surface) {
EGLBoolean success; EGLBoolean success;
success = eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); success = eglDestroySurface(QEgl::display(), (EGLSurface)handle->gl_surface);
if (success == EGL_FALSE) { if (success == EGL_FALSE) {
qWarning() << "destroyGlSurfaceForPixmap() - Error deleting surface: " qWarning() << "destroyGlSurfaceForPixmap() - Error deleting surface: "
<< QEgl::errorString(); << 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); Q_ASSERT(pmd->classId() == QPlatformPixmap::X11Class);
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd); QX11PlatformPixmap *handle = static_cast<QX11PlatformPixmap*>(pmd);
if (pixmapData->gl_surface) { if (handle->gl_surface) {
EGLBoolean success; EGLBoolean success;
success = eglReleaseTexImage(QEgl::display(), success = eglReleaseTexImage(QEgl::display(),
(EGLSurface)pixmapData->gl_surface, (EGLSurface)handle->gl_surface,
EGL_BACK_BUFFER); EGL_BACK_BUFFER);
if (success == EGL_FALSE) { if (success == EGL_FALSE) {
qWarning() << "unbindPixmapFromTexture() - Unable to release bound texture: " qWarning() << "unbindPixmapFromTexture() - Unable to release bound texture: "

View File

@ -42,7 +42,7 @@
#include "private/qpixmapfilter_p.h" #include "private/qpixmapfilter_p.h"
#include "private/qpaintengineex_opengl2_p.h" #include "private/qpaintengineex_opengl2_p.h"
#include "private/qglengineshadermanager_p.h" #include "private/qglengineshadermanager_p.h"
#include "private/qpixmapdata_p.h" #include "qplatformpixmap_qpa.h"
#include "private/qimagepixmapcleanuphooks_p.h" #include "private/qimagepixmapcleanuphooks_p.h"
#include "qglpixmapfilter_p.h" #include "qglpixmapfilter_p.h"
#include "qpaintengine_opengl_p.h" #include "qpaintengine_opengl_p.h"
@ -324,7 +324,7 @@ public:
void timerEvent(QTimerEvent *event); void timerEvent(QTimerEvent *event);
private: private:
static void pixmapDestroyed(QPixmapData *pixmap); static void pixmapDestroyed(QPlatformPixmap *pixmap);
QCache<quint64, QGLBlurTextureInfo > cache; QCache<quint64, QGLBlurTextureInfo > cache;
@ -380,8 +380,8 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe
{ {
static bool hookAdded = false; static bool hookAdded = false;
if (!hookAdded) { if (!hookAdded) {
QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(pixmapDestroyed); QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(pixmapDestroyed);
QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(pixmapDestroyed); QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(pixmapDestroyed);
hookAdded = true; hookAdded = true;
} }
@ -394,7 +394,7 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe
timerId = startTimer(8000); timerId = startTimer(8000);
} }
void QGLBlurTextureCache::pixmapDestroyed(QPixmapData *pmd) void QGLBlurTextureCache::pixmapDestroyed(QPlatformPixmap *pmd)
{ {
foreach (QGLBlurTextureCache *cache, blurTextureCaches) { foreach (QGLBlurTextureCache *cache, blurTextureCaches) {
if (cache->hasBlurTextureInfo(pmd->cacheKey())) if (cache->hasBlurTextureInfo(pmd->cacheKey()))

View File

@ -76,7 +76,7 @@ public:
~QCocoaIntegration(); ~QCocoaIntegration();
bool hasCapability(QPlatformIntegration::Capability cap) const; bool hasCapability(QPlatformIntegration::Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const;

View File

@ -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 QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWindow *window) const

View File

@ -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) 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->width() && data->height());
Q_ASSERT(data->classId() == QPixmapData::BlitterClass); Q_ASSERT(data->classId() == QPlatformPixmap::BlitterClass);
QBlittablePixmapData *blitPm = static_cast<QBlittablePixmapData*>(data); QBlittablePlatformPixmap *blitPm = static_cast<QBlittablePlatformPixmap*>(data);
QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blitPm->blittable()); QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blitPm->blittable());
dfbBlitter->unlock(); dfbBlitter->unlock();

View File

@ -67,7 +67,7 @@ protected:
friend class QDirectFbConvenience; friend class QDirectFbConvenience;
}; };
class QDirectFbBlitterPixmapData : public QBlittablePixmapData class QDirectFbBlitterPlatformPixmap : public QBlittablePlatformPixmap
{ {
public: public:
QBlittable *createBlittable(const QSize &size) const { return new QDirectFbBlitter(size); } QBlittable *createBlittable(const QSize &size) const { return new QDirectFbBlitter(size); }

View File

@ -106,9 +106,9 @@ int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat forma
return ((0x1f << 7) & format) >> 7; return ((0x1f << 7) & format) >> 7;
} }
IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPlatformPixmap(QPlatformPixmap *handle)
{ {
QBlittablePixmapData *blittablePmData = static_cast<QBlittablePixmapData *>(pixmapData); QBlittablePlatformPixmap *blittablePmData = static_cast<QBlittablePlatformPixmap *>(handle);
if (blittablePmData) { if (blittablePmData) {
QBlittable *blittable = blittablePmData->blittable(); QBlittable *blittable = blittablePmData->blittable();
QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blittable); QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blittable);

View File

@ -67,7 +67,7 @@ public:
static IDirectFB *dfbInterface(); static IDirectFB *dfbInterface();
static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY);
static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); static IDirectFBSurface *dfbSurfaceForPlatformPixmap(QPlatformPixmap *);
static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier);
static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask);

View File

@ -70,7 +70,7 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget)
map = cursor->pixmap(); 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) { if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) {
return; return;

View File

@ -53,7 +53,7 @@
#include <private/qpixmap_raster_p.h> #include <private/qpixmap_raster_p.h>
#include <QtGui/private/qpixmap_blitter_p.h> #include <QtGui/private/qpixmap_blitter_p.h>
#include <QtGui/private/qpixmapdata_p.h> #include <QtGui/qplatformpixmap_qpa.h>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtCore/QThread> #include <QtCore/QThread>
#include <QtCore/QAbstractEventDispatcher> #include <QtCore/QAbstractEventDispatcher>
@ -118,12 +118,12 @@ QDirectFbIntegration::~QDirectFbIntegration()
delete mInput; delete mInput;
} }
QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) const QPlatformPixmap *QDirectFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
{ {
if (type == QPixmapData::BitmapType) if (type == QPlatformPixmap::BitmapType)
return new QRasterPixmapData(type); return new QRasterPlatformPixmap(type);
else else
return new QDirectFbBlitterPixmapData; return new QDirectFbBlitterPlatformPixmap;
} }
QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const

View File

@ -85,7 +85,7 @@ public:
QDirectFbIntegration(); QDirectFbIntegration();
~QDirectFbIntegration(); ~QDirectFbIntegration();
QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
QAbstractEventDispatcher *createEventDispatcher() const; QAbstractEventDispatcher *createEventDispatcher() const;

View File

@ -63,7 +63,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId)
dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); dfbWindow->GetSurface(dfbWindow,&m_dfbSurface);
//WRONGSIZE //WRONGSIZE
QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface);
m_pmdata = new QDirectFbBlitterPixmapData; m_pmdata = new QDirectFbBlitterPlatformPixmap;
m_pmdata->setBlittable(blitter); m_pmdata->setBlittable(blitter);
m_pixmap = new QPixmap(m_pmdata); m_pixmap = new QPixmap(m_pmdata);
} }

View File

@ -67,7 +67,7 @@ private:
void lockSurfaceToImage(); void lockSurfaceToImage();
QPixmap *m_pixmap; QPixmap *m_pixmap;
QBlittablePixmapData *m_pmdata; QBlittablePlatformPixmap *m_pmdata;
IDirectFBSurface *m_dfbSurface; IDirectFBSurface *m_dfbSurface;
}; };

View File

@ -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 #ifdef QEGL_EXTRA_DEBUG
qWarning("QEglIntegration::createPixmapData %d\n", type); qWarning("QEglIntegration::createPlatformPixmap %d\n", type);
#endif #endif
return new QRasterPixmapData(type); return new QRasterPlatformPixmap(type);
} }
QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWidget *widget, WId winId) const QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWidget *widget, WId winId) const

View File

@ -57,7 +57,7 @@ public:
QEglFSIntegration(); QEglFSIntegration();
bool hasCapability(QPlatformIntegration::Capability cap) const; 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; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;

View File

@ -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 QWindowSurface *QLinuxFbIntegration::createWindowSurface(QWidget *widget, WId) const

View File

@ -80,7 +80,7 @@ public:
bool hasCapability(QPlatformIntegration::Capability cap) const; 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; QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const;
QAbstractEventDispatcher *createEventDispatcher() const; QAbstractEventDispatcher *createEventDispatcher() const;

View File

@ -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 QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const

View File

@ -71,7 +71,7 @@ public:
bool hasCapability(QPlatformIntegration::Capability cap) const; bool hasCapability(QPlatformIntegration::Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
QAbstractEventDispatcher *createEventDispatcher() const; QAbstractEventDispatcher *createEventDispatcher() const;

View File

@ -43,7 +43,7 @@
#include "qopenkodewindow.h" #include "qopenkodewindow.h"
#include "qopenkodeeventloopintegration.h" #include "qopenkodeeventloopintegration.h"
#include <QtOpenGL/private/qpixmapdata_gl_p.h> #include <QtOpenGL/qplatformpixmap_gl_p.h>
#include <QtOpenGL/private/qwindowsurface_gl_p.h> #include <QtOpenGL/private/qwindowsurface_gl_p.h>
#include <QtGui/private/qpixmap_raster_p.h> #include <QtGui/private/qpixmap_raster_p.h>
@ -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 QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) const

View File

@ -92,7 +92,7 @@ public:
bool hasCapability(QPlatformIntegration::Capability cap) const; 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; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;

View File

@ -41,7 +41,7 @@
#include "qgraphicssystem_vglite.h" #include "qgraphicssystem_vglite.h"
#include "qwindowsurface_vglite.h" #include "qwindowsurface_vglite.h"
#include <QtOpenVG/private/qpixmapdata_vg_p.h> #include <QtOpenVG/qplatformpixmap_vg_p.h>
#include <QtGui/private/qegl_p.h> #include <QtGui/private/qegl_p.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#ifdef OPENVG_USBHP_INIT #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) #if !defined(QVGLite_NO_SINGLE_CONTEXT) && !defined(QVGLite_NO_PIXMAP_DATA)
// Pixmaps can use QVGLitePixmapData; bitmaps must use raster. // Pixmaps can use QVGLitePlatformPixmap; bitmaps must use raster.
if (type == QPixmapData::PixmapType) if (type == QPlatformPixmap::PixmapType)
return new QVGPixmapData(type); return new QVGPlatformPixmap(type);
else else
return new QRasterPixmapData(type); return new QRasterPlatformPixmap(type);
#else #else
return new QRasterPixmapData(type); return new QRasterPlatformPixmap(type);
#endif #endif
} }

View File

@ -57,7 +57,7 @@ public:
QVGLiteGraphicsSystem(); QVGLiteGraphicsSystem();
~QVGLiteGraphicsSystem(); ~QVGLiteGraphicsSystem();
QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QWindowSurface *createWindowSurface(QWidget *widget) const; QWindowSurface *createWindowSurface(QWidget *widget) const;
QList<QGraphicsSystemScreen *> screens() const { return mScreens; } QList<QGraphicsSystemScreen *> screens() const { return mScreens; }

View File

@ -423,9 +423,9 @@ QVFbIntegration::QVFbIntegration(const QStringList &paramList)
mScreens.append(mPrimaryScreen); 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 QWindowSurface *QVFbIntegration::createWindowSurface(QWidget *widget, WId) const

View File

@ -79,7 +79,7 @@ class QVFbIntegration : public QPlatformIntegration
public: public:
QVFbIntegration(const QStringList &paramList); QVFbIntegration(const QStringList &paramList);
QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
QAbstractEventDispatcher *createEventDispatcher() const; QAbstractEventDispatcher *createEventDispatcher() const;

View File

@ -52,7 +52,7 @@ public:
QUIKitIntegration(); QUIKitIntegration();
~QUIKitIntegration(); ~QUIKitIntegration();
QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;

View File

@ -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 QPlatformWindow *QUIKitIntegration::createPlatformWindow(QWidget *widget, WId winId) const

View File

@ -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 QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const

View File

@ -82,7 +82,7 @@ public:
QVNCIntegration(const QStringList& paramList); QVNCIntegration(const QStringList& paramList);
bool hasCapability(QPlatformIntegration::Capability cap) const; 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; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
QAbstractEventDispatcher createEventDispatcher() const; QAbstractEventDispatcher createEventDispatcher() const;

View File

@ -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 QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const

View File

@ -56,7 +56,7 @@ public:
QWaylandIntegration(); QWaylandIntegration();
bool hasCapability(QPlatformIntegration::Capability cap) const; bool hasCapability(QPlatformIntegration::Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;

View File

@ -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 QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const

View File

@ -57,7 +57,7 @@ public:
~QXcbIntegration(); ~QXcbIntegration();
bool hasCapability(Capability cap) const; bool hasCapability(Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;

View File

@ -59,7 +59,7 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#endif //!defined(QT_OPENGL_ES_2) #endif //!defined(QT_OPENGL_ES_2)
#include <private/qwindowsurface_gl_p.h> #include <private/qwindowsurface_gl_p.h>
#include <private/qpixmapdata_gl_p.h> #include <qplatformpixmap_gl_p.h>
#endif //QT_NO_OPENGL #endif //QT_NO_OPENGL
QT_BEGIN_NAMESPACE 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 #ifndef QT_NO_OPENGL
if (mUseOpenGL) if (mUseOpenGL)
return new QGLPixmapData(type); return new QGLPlatformPixmap(type);
#endif #endif
return new QRasterPixmapData(type); return new QRasterPlatformPixmap(type);
} }
QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const

View File

@ -61,7 +61,7 @@ public:
QXlibIntegration(bool useOpenGL = false); QXlibIntegration(bool useOpenGL = false);
bool hasCapability(Capability cap) const; bool hasCapability(Capability cap) const;
QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
QAbstractEventDispatcher *createEventDispatcher() const; QAbstractEventDispatcher *createEventDispatcher() const;

View File

@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui) QT_MODULE(Gui)
class QPainter; class QPainter;
class QPixmapData; class QPlatformPixmap;
class QPixmapFilterPrivate; class QPixmapFilterPrivate;

View File

@ -121,16 +121,16 @@ Q_WIDGETS_EXPORT CGContextRef qt_mac_cg_context(const QPaintDevice *pdev)
CGContextRef ret = 0; CGContextRef ret = 0;
// It would make sense to put this into a mac #ifdef'ed // It would make sense to put this into a mac #ifdef'ed
// virtual function in the QPixmapData at some point // virtual function in the QPlatformPixmap at some point
if (pm->data->classId() == QPixmapData::MacClass) { if (pm->data->classId() == QPlatformPixmap::MacClass) {
const QMacPixmapData *pmData = static_cast<const QMacPixmapData*>(pm->data.data()); const QMacPlatformPixmap *pmData = static_cast<const QMacPlatformPixmap*>(pm->data.data());
ret = CGBitmapContextCreate(pmData->pixels, pmData->w, pmData->h, ret = CGBitmapContextCreate(pmData->pixels, pmData->w, pmData->h,
8, pmData->bytesPerRow, colorspace, 8, pmData->bytesPerRow, colorspace,
flags); flags);
if(!ret) if(!ret)
qWarning("QPaintDevice: Unable to create context for pixmap (%d/%d/%d)", qWarning("QPaintDevice: Unable to create context for pixmap (%d/%d/%d)",
pmData->w, pmData->h, (pmData->bytesPerRow * pmData->h)); 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(); QImage *image = pm->data->buffer();
ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(), ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
8, image->bytesPerLine(), colorspace, flags); 8, image->bytesPerLine(), colorspace, flags);

View File

@ -75,26 +75,26 @@ static int qt_pixmap_serial = 0;
Q_WIDGETS_EXPORT quint32 *qt_mac_pixmap_get_base(const QPixmap *pix) Q_WIDGETS_EXPORT quint32 *qt_mac_pixmap_get_base(const QPixmap *pix)
{ {
if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
return reinterpret_cast<quint32 *>(static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bits()); return reinterpret_cast<quint32 *>(static_cast<QRasterPlatformPixmap*>(pix->data.data())->buffer()->bits());
else else
return static_cast<QMacPixmapData*>(pix->data.data())->pixels; return static_cast<QMacPlatformPixmap*>(pix->data.data())->pixels;
} }
Q_WIDGETS_EXPORT int qt_mac_pixmap_get_bytes_per_line(const QPixmap *pix) Q_WIDGETS_EXPORT int qt_mac_pixmap_get_bytes_per_line(const QPixmap *pix)
{ {
if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
return static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bytesPerLine(); return static_cast<QRasterPlatformPixmap*>(pix->data.data())->buffer()->bytesPerLine();
else else
return static_cast<QMacPixmapData*>(pix->data.data())->bytesPerRow; return static_cast<QMacPlatformPixmap*>(pix->data.data())->bytesPerRow;
} }
void qt_mac_cgimage_data_free(void *info, const void *memoryToFree, size_t) void qt_mac_cgimage_data_free(void *info, const void *memoryToFree, size_t)
{ {
QMacPixmapData *pmdata = static_cast<QMacPixmapData *>(info); QMacPlatformPixmap *pmdata = static_cast<QMacPlatformPixmap *>(info);
if (!pmdata) { if (!pmdata) {
free(const_cast<void *>(memoryToFree)); free(const_cast<void *>(memoryToFree));
} else { } else {
if (QMacPixmapData::validDataPointers.contains(pmdata) == false) { if (QMacPlatformPixmap::validDataPointers.contains(pmdata) == false) {
free(const_cast<void *>(memoryToFree)); free(const_cast<void *>(memoryToFree));
return; return;
} }
@ -163,26 +163,26 @@ static inline QRgb qt_conv16ToRgb(ushort c) {
return qRgb(tr,tg,tb); return qRgb(tr,tg,tb);
} }
QSet<QMacPixmapData*> QMacPixmapData::validDataPointers; QSet<QMacPlatformPixmap*> QMacPlatformPixmap::validDataPointers;
QMacPixmapData::QMacPixmapData(PixelType type) QMacPlatformPixmap::QMacPlatformPixmap(PixelType type)
: QPixmapData(type, MacClass), has_alpha(0), has_mask(0), : QPlatformPixmap(type, MacClass), has_alpha(0), has_mask(0),
uninit(true), pixels(0), pixelsSize(0), pixelsToFree(0), uninit(true), pixels(0), pixelsSize(0), pixelsToFree(0),
bytesPerRow(0), cg_data(0), cg_dataBeingReleased(0), cg_mask(0), bytesPerRow(0), cg_data(0), cg_dataBeingReleased(0), cg_mask(0),
pengine(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 BEST_BYTE_ALIGNMENT 16
#define COMPTUE_BEST_BYTES_PER_ROW(bpr) \ #define COMPTUE_BEST_BYTES_PER_ROW(bpr) \
(((bpr) + (BEST_BYTE_ALIGNMENT - 1)) & ~(BEST_BYTE_ALIGNMENT - 1)) (((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); setSerialNumber(++qt_pixmap_serial);
@ -214,7 +214,7 @@ void QMacPixmapData::resize(int width, int height)
#undef COMPUTE_BEST_BYTES_PER_ROW #undef COMPUTE_BEST_BYTES_PER_ROW
void QMacPixmapData::fromImage(const QImage &img, void QMacPlatformPixmap::fromImage(const QImage &img,
Qt::ImageConversionFlags flags) Qt::ImageConversionFlags flags)
{ {
setSerialNumber(++qt_pixmap_serial); setSerialNumber(++qt_pixmap_serial);
@ -371,7 +371,7 @@ int get_index(QImage * qi,QRgb mycol)
return qi->colorCount(); return qi->colorCount();
} }
QImage QMacPixmapData::toImage() const QImage QMacPlatformPixmap::toImage() const
{ {
QImage::Format format = QImage::Format_MonoLSB; QImage::Format format = QImage::Format_MonoLSB;
if (d != 1) //Doesn't support index color modes if (d != 1) //Doesn't support index color modes
@ -405,7 +405,7 @@ QImage QMacPixmapData::toImage() const
return image; 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 { //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); macSetHasAlpha(true);
} }
QPixmap QMacPixmapData::alphaChannel() const QPixmap QMacPlatformPixmap::alphaChannel() const
{ {
if (!has_alpha) if (!has_alpha)
return QPixmap(); return QPixmap();
QMacPixmapData *alpha = new QMacPixmapData(PixmapType); QMacPlatformPixmap *alpha = new QMacPlatformPixmap(PixmapType);
alpha->resize(w, h); alpha->resize(w, h);
macGetAlphaChannel(alpha, false); macGetAlphaChannel(alpha, false);
return QPixmap(alpha); return QPixmap(alpha);
} }
void QMacPixmapData::setAlphaChannel(const QPixmap &alpha) void QMacPlatformPixmap::setAlphaChannel(const QPixmap &alpha)
{ {
has_mask = true; has_mask = true;
QMacPixmapData *alphaData = static_cast<QMacPixmapData*>(alpha.data.data()); QMacPlatformPixmap *alphaData = static_cast<QMacPlatformPixmap*>(alpha.data.data());
macSetAlphaChannel(alphaData, false); macSetAlphaChannel(alphaData, false);
} }
QBitmap QMacPixmapData::mask() const QBitmap QMacPlatformPixmap::mask() const
{ {
if (!has_mask && !has_alpha) if (!has_mask && !has_alpha)
return QBitmap(); return QBitmap();
QMacPixmapData *mask = new QMacPixmapData(BitmapType); QMacPlatformPixmap *mask = new QMacPlatformPixmap(BitmapType);
mask->resize(w, h); mask->resize(w, h);
macGetAlphaChannel(mask, true); macGetAlphaChannel(mask, true);
return QPixmap(mask); return QPixmap(mask);
} }
void QMacPixmapData::setMask(const QBitmap &mask) void QMacPlatformPixmap::setMask(const QBitmap &mask)
{ {
if (mask.isNull()) { if (mask.isNull()) {
QMacPixmapData opaque(PixmapType); QMacPlatformPixmap opaque(PixmapType);
opaque.resize(w, h); opaque.resize(w, h);
opaque.fill(QColor(255, 255, 255, 255)); opaque.fill(QColor(255, 255, 255, 255));
macSetAlphaChannel(&opaque, true); macSetAlphaChannel(&opaque, true);
@ -469,11 +469,11 @@ void QMacPixmapData::setMask(const QBitmap &mask)
has_alpha = false; has_alpha = false;
has_mask = true; has_mask = true;
QMacPixmapData *maskData = static_cast<QMacPixmapData*>(mask.data.data()); QMacPlatformPixmap *maskData = static_cast<QMacPlatformPixmap*>(mask.data.data());
macSetAlphaChannel(maskData, true); macSetAlphaChannel(maskData, true);
} }
int QMacPixmapData::metric(QPaintDevice::PaintDeviceMetric theMetric) const int QMacPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric theMetric) const
{ {
switch (theMetric) { switch (theMetric) {
case QPaintDevice::PdmWidth: case QPaintDevice::PdmWidth:
@ -504,7 +504,7 @@ int QMacPixmapData::metric(QPaintDevice::PaintDeviceMetric theMetric) const
return 0; return 0;
} }
QMacPixmapData::~QMacPixmapData() QMacPlatformPixmap::~QMacPlatformPixmap()
{ {
validDataPointers.remove(this); validDataPointers.remove(this);
if (cg_mask) { if (cg_mask) {
@ -521,7 +521,7 @@ QMacPixmapData::~QMacPixmapData()
free(pixelsToFree); 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) if (!pixels || !h || !w || pix->w != w || pix->h != h)
return; return;
@ -567,7 +567,7 @@ void QMacPixmapData::macSetAlphaChannel(const QMacPixmapData *pix, bool asMask)
macSetHasAlpha(true); macSetHasAlpha(true);
} }
void QMacPixmapData::macGetAlphaChannel(QMacPixmapData *pix, bool asMask) const void QMacPlatformPixmap::macGetAlphaChannel(QMacPlatformPixmap *pix, bool asMask) const
{ {
quint32 *dptr = pix->pixels, *drow; quint32 *dptr = pix->pixels, *drow;
const uint dbpr = pix->bytesPerRow; 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; has_alpha = b;
macReleaseCGImageRef(); macReleaseCGImageRef();
} }
void QMacPixmapData::macCreateCGImageRef() void QMacPlatformPixmap::macCreateCGImageRef()
{ {
Q_ASSERT(cg_data == 0); Q_ASSERT(cg_data == 0);
//create the cg data //create the cg data
@ -615,7 +615,7 @@ void QMacPixmapData::macCreateCGImageRef()
cgflags, provider, 0, 0, kCGRenderingIntentDefault); cgflags, provider, 0, 0, kCGRenderingIntentDefault);
} }
void QMacPixmapData::macReleaseCGImageRef() void QMacPlatformPixmap::macReleaseCGImageRef()
{ {
if (!cg_data) if (!cg_data)
return; // There's nothing we need to do 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 // 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. // 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; const int numBytes = bytesPerRow * h;
quint32 *base_pixels; quint32 *base_pixels;
@ -654,7 +654,7 @@ void QMacPixmapData::macCreatePixels()
} }
#if 0 #if 0
QPixmap QMacPixmapData::transformed(const QTransform &transform, QPixmap QMacPlatformPixmap::transformed(const QTransform &transform,
Qt::TransformationMode mode) const Qt::TransformationMode mode) const
{ {
int w, h; // size of target pixmap int w, h; // size of target pixmap
@ -682,15 +682,15 @@ QPixmap QMacPixmapData::transformed(const QTransform &transform,
return QPixmap(); return QPixmap();
// create destination // create destination
QMacPixmapData *pm = new QMacPixmapData(pixelType(), w, h); QMacPlatformPixmap *pm = new QMacPlatformPixmap(pixelType(), w, h);
const quint32 *sptr = pixels; const quint32 *sptr = pixels;
quint32 *dptr = pm->pixels; quint32 *dptr = pm->pixels;
memset(dptr, 0, (pm->bytesPerRow * pm->h)); memset(dptr, 0, (pm->bytesPerRow * pm->h));
// do the transform // do the transform
if (mode == Qt::SmoothTransformation) { if (mode == Qt::SmoothTransformation) {
#warning QMacPixmapData::transformed not properly implemented #warning QMacPlatformPixmap::transformed not properly implemented
qWarning("QMacPixmapData::transformed not properly implemented"); qWarning("QMacPlatformPixmap::transformed not properly implemented");
#if 0 #if 0
QPainter p(&pm); QPainter p(&pm);
p.setRenderHint(QPainter::Antialiasing); 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, if (!qt_xForm_helper(mat, 0, QT_XFORM_TYPE_MSBFIRST, bpp,
(uchar*)dptr, xbpl, (pm->bytesPerRow) - xbpl, (uchar*)dptr, xbpl, (pm->bytesPerRow) - xbpl,
h, (uchar*)sptr, (bytesPerRow), ws, hs)) { h, (uchar*)sptr, (bytesPerRow), ws, hs)) {
qWarning("QMacPixmapData::transform(): failure"); qWarning("QMacPlatformPixmap::transform(): failure");
return QPixmap(); return QPixmap();
} }
} }
@ -984,27 +984,27 @@ Qt::HANDLE QPixmap::macCGHandle() const
if (isNull()) if (isNull())
return 0; return 0;
if (data->classId() == QPixmapData::MacClass) { if (data->classId() == QPlatformPixmap::MacClass) {
QMacPixmapData *d = static_cast<QMacPixmapData *>(data.data()); QMacPlatformPixmap *d = static_cast<QMacPlatformPixmap *>(data.data());
if (!d->cg_data) if (!d->cg_data)
d->macCreateCGImageRef(); d->macCreateCGImageRef();
CGImageRef ret = d->cg_data; CGImageRef ret = d->cg_data;
CGImageRetain(ret); CGImageRetain(ret);
return ret; return ret;
} else if (data->classId() == QPixmapData::RasterClass) { } else if (data->classId() == QPlatformPixmap::RasterClass) {
return qt_mac_image_to_cgimage(static_cast<QRasterPixmapData *>(data.data())->image); return qt_mac_image_to_cgimage(static_cast<QRasterPlatformPixmap *>(data.data())->image);
} }
return 0; return 0;
} }
bool QMacPixmapData::hasAlphaChannel() const bool QMacPlatformPixmap::hasAlphaChannel() const
{ {
return has_alpha; return has_alpha;
} }
CGImageRef qt_mac_create_imagemask(const QPixmap &pixmap, const QRectF &sr) CGImageRef qt_mac_create_imagemask(const QPixmap &pixmap, const QRectF &sr)
{ {
QMacPixmapData *px = static_cast<QMacPixmapData*>(pixmap.data.data()); QMacPlatformPixmap *px = static_cast<QMacPlatformPixmap*>(pixmap.data.data());
if (px->cg_mask) { if (px->cg_mask) {
if (px->cg_mask_rect == sr) { if (px->cg_mask_rect == sr) {
CGImageRetain(px->cg_mask); //reference for the caller CGImageRetain(px->cg_mask); //reference for the caller
@ -1114,23 +1114,23 @@ IconRef qt_mac_create_iconref(const QPixmap &px)
#endif #endif
/*! \internal */ /*! \internal */
QPaintEngine* QMacPixmapData::paintEngine() const QPaintEngine* QMacPlatformPixmap::paintEngine() const
{ {
if (!pengine) { if (!pengine) {
QMacPixmapData *that = const_cast<QMacPixmapData*>(this); QMacPlatformPixmap *that = const_cast<QMacPlatformPixmap*>(this);
that->pengine = new QCoreGraphicsPaintEngine(); that->pengine = new QCoreGraphicsPaintEngine();
} }
return pengine; return pengine;
} }
void QMacPixmapData::copy(const QPixmapData *data, const QRect &rect) void QMacPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect)
{ {
if (data->pixelType() == BitmapType) { if (data->pixelType() == BitmapType) {
QBitmap::fromImage(toImage().copy(rect)); QBitmap::fromImage(toImage().copy(rect));
return; return;
} }
const QMacPixmapData *macData = static_cast<const QMacPixmapData*>(data); const QMacPlatformPixmap *macData = static_cast<const QMacPlatformPixmap*>(data);
resize(rect.width(), rect.height()); resize(rect.width(), rect.height());
@ -1152,7 +1152,7 @@ void QMacPixmapData::copy(const QPixmapData *data, const QRect &rect)
has_mask = macData->has_mask; 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(dx);
Q_UNUSED(dy); Q_UNUSED(dy);

View File

@ -53,23 +53,23 @@
// We mean it. // We mean it.
// //
#include <QtGui/private/qpixmapdata_p.h> #include <QtGui/qplatformpixmap_qpa.h>
#include <QtGui/private/qpixmapdatafactory_p.h> #include <QtGui/qplatformpixmapfactory_p.h>
#include <QtGui/private/qt_mac_p.h> #include <QtGui/private/qt_mac_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QMacPixmapData : public QPixmapData class QMacPlatformPixmap : public QPlatformPixmap
{ {
public: public:
QMacPixmapData(PixelType type); QMacPlatformPixmap(PixelType type);
~QMacPixmapData(); ~QMacPlatformPixmap();
QPixmapData *createCompatiblePixmapData() const; QPlatformPixmap *createCompatiblePlatformPixmap() const;
void resize(int width, int height); void resize(int width, int height);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags); 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); bool scroll(int dx, int dy, const QRect &rect);
int metric(QPaintDevice::PaintDeviceMetric metric) const; int metric(QPaintDevice::PaintDeviceMetric metric) const;
@ -89,8 +89,8 @@ private:
uint has_alpha : 1, has_mask : 1, uninit : 1; uint has_alpha : 1, has_mask : 1, uninit : 1;
void macSetHasAlpha(bool b); void macSetHasAlpha(bool b);
void macGetAlphaChannel(QMacPixmapData *, bool asMask) const; void macGetAlphaChannel(QMacPlatformPixmap *, bool asMask) const;
void macSetAlphaChannel(const QMacPixmapData *, bool asMask); void macSetAlphaChannel(const QMacPlatformPixmap *, bool asMask);
void macCreateCGImageRef(); void macCreateCGImageRef();
void macCreatePixels(); void macCreatePixels();
void macReleaseCGImageRef(); void macReleaseCGImageRef();
@ -112,7 +112,7 @@ private:
uint bytesPerRow; uint bytesPerRow;
QRectF cg_mask_rect; QRectF cg_mask_rect;
CGImageRef cg_data, cg_dataBeingReleased, cg_mask; CGImageRef cg_data, cg_dataBeingReleased, cg_mask;
static QSet<QMacPixmapData*> validDataPointers; static QSet<QMacPlatformPixmap*> validDataPointers;
QPaintEngine *pengine; QPaintEngine *pengine;

View File

@ -1905,7 +1905,7 @@ void qt_cleanup()
qt_S60Beep = 0; qt_S60Beep = 0;
} }
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles 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 #ifdef QT_NO_FREETYPE
qt_cleanup_symbianFontDatabase(); qt_cleanup_symbianFontDatabase();

View File

@ -51,8 +51,8 @@ public:
QS60PaintEnginePrivate() {} QS60PaintEnginePrivate() {}
}; };
QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PixmapData *data) QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PlatformPixmap *data)
: QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), pixmapData(data) : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), handle(data)
{ {
} }
@ -60,11 +60,11 @@ bool QS60PaintEngine::begin(QPaintDevice *device)
{ {
Q_D(QS60PaintEngine); Q_D(QS60PaintEngine);
if (pixmapData->classId() == QPixmapData::RasterClass) { if (handle->classId() == QPlatformPixmap::RasterClass) {
pixmapData->beginDataAccess(); handle->beginDataAccess();
bool ret = QRasterPaintEngine::begin(device); bool ret = QRasterPaintEngine::begin(device);
// Make sure QPaintEngine::paintDevice() returns the proper 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. // which is incorrect in Symbian.
d->pdev = device; d->pdev = device;
return ret; return ret;
@ -75,9 +75,9 @@ bool QS60PaintEngine::begin(QPaintDevice *device)
bool QS60PaintEngine::end() bool QS60PaintEngine::end()
{ {
if (pixmapData->classId() == QPixmapData::RasterClass) { if (handle->classId() == QPlatformPixmap::RasterClass) {
bool ret = QRasterPaintEngine::end(); bool ret = QRasterPaintEngine::end();
pixmapData->endDataAccess(); handle->endDataAccess();
return ret; return ret;
} }
return QRasterPaintEngine::end(); return QRasterPaintEngine::end();
@ -85,13 +85,13 @@ bool QS60PaintEngine::end()
void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
{ {
if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { if (pm.handle()->classId() == QPlatformPixmap::RasterClass) {
QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); QS60PlatformPixmap *srcData = static_cast<QS60PlatformPixmap *>(pm.handle());
srcData->beginDataAccess(); srcData->beginDataAccess();
QRasterPaintEngine::drawPixmap(p, pm); QRasterPaintEngine::drawPixmap(p, pm);
srcData->endDataAccess(); srcData->endDataAccess();
} else { } else {
void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage);
if (nativeData) { if (nativeData) {
QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
img->beginDataAccess(); 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) void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
{ {
if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { if (pm.handle()->classId() == QPlatformPixmap::RasterClass) {
QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); QS60PlatformPixmap *srcData = static_cast<QS60PlatformPixmap *>(pm.handle());
srcData->beginDataAccess(); srcData->beginDataAccess();
QRasterPaintEngine::drawPixmap(r, pm, sr); QRasterPaintEngine::drawPixmap(r, pm, sr);
srcData->endDataAccess(); srcData->endDataAccess();
} else { } else {
void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage);
if (nativeData) { if (nativeData) {
QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
img->beginDataAccess(); 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) void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
{ {
if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { if (pm.handle()->classId() == QPlatformPixmap::RasterClass) {
QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); QS60PlatformPixmap *srcData = static_cast<QS60PlatformPixmap *>(pm.handle());
srcData->beginDataAccess(); srcData->beginDataAccess();
QRasterPaintEngine::drawTiledPixmap(r, pm, sr); QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
srcData->endDataAccess(); srcData->endDataAccess();

View File

@ -58,14 +58,14 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QS60PaintEnginePrivate; class QS60PaintEnginePrivate;
class QS60PixmapData; class QS60PlatformPixmap;
class QS60PaintEngine : public QRasterPaintEngine class QS60PaintEngine : public QRasterPaintEngine
{ {
Q_DECLARE_PRIVATE(QS60PaintEngine) Q_DECLARE_PRIVATE(QS60PaintEngine)
public: public:
QS60PaintEngine(QPaintDevice *device, QS60PixmapData* data); QS60PaintEngine(QPaintDevice *device, QS60PlatformPixmap* data);
bool begin(QPaintDevice *device); bool begin(QPaintDevice *device);
bool end(); bool end();
@ -76,7 +76,7 @@ public:
void prepare(QImage* image); void prepare(QImage* image);
private: private:
QS60PixmapData *pixmapData; QS60PlatformPixmap *handle;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -65,10 +65,10 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
0x10, 0x20, 0x40, 0x80 }; 0x10, 0x20, 0x40, 0x80 };
static bool cleanup_function_registered = false; static bool cleanup_function_registered = false;
static QS60PixmapData *firstPixmap = 0; static QS60PlatformPixmap *firstPixmap = 0;
// static // static
void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd) void QS60PlatformPixmap::qt_symbian_register_pixmap(QS60PlatformPixmap *pd)
{ {
if (!cleanup_function_registered) { if (!cleanup_function_registered) {
qAddPostRoutine(qt_symbian_release_pixmaps); qAddPostRoutine(qt_symbian_release_pixmaps);
@ -83,7 +83,7 @@ void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd)
} }
// static // static
void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd) void QS60PlatformPixmap::qt_symbian_unregister_pixmap(QS60PlatformPixmap *pd)
{ {
if (pd->next) if (pd->next)
pd->next->prev = pd->prev; pd->next->prev = pd->prev;
@ -94,10 +94,10 @@ void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd)
} }
// static // static
void QS60PixmapData::qt_symbian_release_pixmaps() void QS60PlatformPixmap::qt_symbian_release_pixmaps()
{ {
// Scan all QS60PixmapData objects in the system and destroy them. // Scan all QS60PlatformPixmap objects in the system and destroy them.
QS60PixmapData *pd = firstPixmap; QS60PlatformPixmap *pd = firstPixmap;
while (pd != 0) { while (pd != 0) {
pd->release(); pd->release();
pd = pd->next; pd = pd->next;
@ -358,11 +358,11 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h)
*/ */
CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const
{ {
QPixmapData *data = pixmapData(); QPlatformPixmap *data = handle();
if (!data || data->isNull()) if (!data || data->isNull())
return 0; return 0;
return reinterpret_cast<CFbsBitmap*>(data->toNativeType(QPixmapData::FbsBitmap)); return reinterpret_cast<CFbsBitmap*>(data->toNativeType(QPlatformPixmap::FbsBitmap));
} }
/*! /*!
@ -387,13 +387,13 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
if (!bitmap) if (!bitmap)
return QPixmap(); return QPixmap();
QScopedPointer<QPixmapData> data(QPixmapData::create(0,0, QPixmapData::PixmapType)); QScopedPointer<QPlatformPixmap> data(QPlatformPixmap::create(0,0, QPlatformPixmap::PixmapType));
data->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::FbsBitmap); data->fromNativeType(reinterpret_cast<void*>(bitmap), QPlatformPixmap::FbsBitmap);
QPixmap pixmap(data.take()); QPixmap pixmap(data.take());
return pixmap; return pixmap;
} }
QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), QS60PlatformPixmap::QS60PlatformPixmap(PixelType type) : QRasterPlatformPixmap(type),
symbianBitmapDataAccess(new QSymbianBitmapDataAccess), symbianBitmapDataAccess(new QSymbianBitmapDataAccess),
cfbsBitmap(0), cfbsBitmap(0),
pengine(0), pengine(0),
@ -405,14 +405,14 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
qt_symbian_register_pixmap(this); qt_symbian_register_pixmap(this);
} }
QS60PixmapData::~QS60PixmapData() QS60PlatformPixmap::~QS60PlatformPixmap()
{ {
release(); release();
delete symbianBitmapDataAccess; delete symbianBitmapDataAccess;
qt_symbian_unregister_pixmap(this); qt_symbian_unregister_pixmap(this);
} }
void QS60PixmapData::resize(int width, int height) void QS60PlatformPixmap::resize(int width, int height)
{ {
if (width <= 0 || height <= 0) { if (width <= 0 || height <= 0) {
w = width; w = width;
@ -446,7 +446,7 @@ void QS60PixmapData::resize(int width, int height)
} }
} }
void QS60PixmapData::release() void QS60PlatformPixmap::release()
{ {
if (cfbsBitmap) { if (cfbsBitmap) {
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
@ -464,7 +464,7 @@ void QS60PixmapData::release()
/*! /*!
* Takes ownership of bitmap. Used by window surface * 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); 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<QS60PixmapData*>(this); QS60PlatformPixmap *that = const_cast<QS60PlatformPixmap*>(this);
that->beginDataAccess(); that->beginDataAccess();
QImage copy = that->image.copy(r); QImage copy = that->image.copy(r);
that->endDataAccess(); that->endDataAccess();
@ -506,7 +506,7 @@ QImage QS60PixmapData::toImage(const QRect &r) const
return copy; return copy;
} }
void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) void QS60PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
{ {
release(); 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<const QS60PixmapData*>(data); const QS60PlatformPixmap *s60Data = static_cast<const QS60PlatformPixmap*>(data);
fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither); 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(); beginDataAccess();
bool res = QRasterPixmapData::scroll(dx, dy, rect); bool res = QRasterPlatformPixmap::scroll(dx, dy, rect);
endDataAccess(); endDataAccess();
return res; return res;
} }
int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const int QS60PlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const
{ {
if (!cfbsBitmap) if (!cfbsBitmap)
return 0; 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) { if (color.alpha() != 255) {
QImage im(width(), height(), QImage::Format_ARGB32_Premultiplied); QImage im(width(), height(), QImage::Format_ARGB32_Premultiplied);
@ -642,12 +642,12 @@ void QS60PixmapData::fill(const QColor &color)
fromImage(im, Qt::AutoColor | Qt::OrderedAlphaDither); fromImage(im, Qt::AutoColor | Qt::OrderedAlphaDither);
} else { } else {
beginDataAccess(); beginDataAccess();
QRasterPixmapData::fill(color); QRasterPlatformPixmap::fill(color);
endDataAccess(); endDataAccess();
} }
} }
void QS60PixmapData::setMask(const QBitmap &mask) void QS60PlatformPixmap::setMask(const QBitmap &mask)
{ {
if (mask.size().isEmpty()) { if (mask.size().isEmpty()) {
if (image.depth() != 1) { if (image.depth() != 1) {
@ -657,7 +657,7 @@ void QS60PixmapData::setMask(const QBitmap &mask)
} }
} else if (image.depth() == 1) { } else if (image.depth() == 1) {
beginDataAccess(); beginDataAccess();
QRasterPixmapData::setMask(mask); QRasterPlatformPixmap::setMask(mask);
endDataAccess(); endDataAccess();
} else { } else {
const int w = image.width(); 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()); QImage img(toImage());
img.setAlphaChannel(alphaChannel.toImage()); img.setAlphaChannel(alphaChannel.toImage());
@ -686,21 +686,21 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel)
fromImage(img, Qt::OrderedDither | Qt::OrderedAlphaDither); fromImage(img, Qt::OrderedDither | Qt::OrderedAlphaDither);
} }
QImage QS60PixmapData::toImage() const QImage QS60PlatformPixmap::toImage() const
{ {
return toImage(QRect()); return toImage(QRect());
} }
QPaintEngine* QS60PixmapData::paintEngine() const QPaintEngine* QS60PlatformPixmap::paintEngine() const
{ {
if (!pengine) { if (!pengine) {
QS60PixmapData *that = const_cast<QS60PixmapData*>(this); QS60PlatformPixmap *that = const_cast<QS60PlatformPixmap*>(this);
that->pengine = new QS60PaintEngine(&that->image, that); that->pengine = new QS60PaintEngine(&that->image, that);
} }
return pengine; return pengine;
} }
void QS60PixmapData::beginDataAccess() void QS60PlatformPixmap::beginDataAccess()
{ {
if(!cfbsBitmap) if(!cfbsBitmap)
return; return;
@ -745,7 +745,7 @@ void QS60PixmapData::beginDataAccess()
} }
} }
void QS60PixmapData::endDataAccess(bool readOnly) const void QS60PlatformPixmap::endDataAccess(bool readOnly) const
{ {
Q_UNUSED(readOnly); Q_UNUSED(readOnly);
@ -778,8 +778,8 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage)
if (!sgImage) if (!sgImage)
return QPixmap(); return QPixmap();
QScopedPointer<QPixmapData> data(QPixmapData::create(0,0, QPixmapData::PixmapType)); QScopedPointer<QPlatformPixmap> data(QPlatformPixmap::create(0,0, QPlatformPixmap::PixmapType));
data->fromNativeType(reinterpret_cast<void*>(sgImage), QPixmapData::SgImage); data->fromNativeType(reinterpret_cast<void*>(sgImage), QPlatformPixmap::SgImage);
QPixmap pixmap(data.take()); QPixmap pixmap(data.take());
return pixmap; return pixmap;
} }
@ -807,16 +807,16 @@ RSgImage *QPixmap::toSymbianRSgImage() const
if (isNull()) if (isNull())
return 0; return 0;
RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmapData()->toNativeType(QPixmapData::SgImage)); RSgImage *sgImage = reinterpret_cast<RSgImage*>(handle()->toNativeType(QPlatformPixmap::SgImage));
return sgImage; return sgImage;
} }
void* QS60PixmapData::toNativeType(NativeType type) void* QS60PlatformPixmap::toNativeType(NativeType type)
{ {
if (type == QPixmapData::SgImage) { if (type == QPlatformPixmap::SgImage) {
return 0; return 0;
} else if (type == QPixmapData::FbsBitmap) { } else if (type == QPlatformPixmap::FbsBitmap) {
if (isNull() || !cfbsBitmap) if (isNull() || !cfbsBitmap)
return 0; return 0;
@ -895,11 +895,11 @@ void* QS60PixmapData::toNativeType(NativeType type)
return 0; 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; return;
} else if (nativeType == QPixmapData::FbsBitmap && pixmap) { } else if (nativeType == QPlatformPixmap::FbsBitmap && pixmap) {
CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap); CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap);
@ -955,8 +955,8 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
type = (format != QImage::Format_MonoLSB) type = (format != QImage::Format_MonoLSB)
? QPixmapData::PixmapType ? QPlatformPixmap::PixmapType
: QPixmapData::BitmapType; : QPlatformPixmap::BitmapType;
if (needsCopy) { 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<TDisplayMode>(mode); const TDisplayMode displayMode = static_cast<TDisplayMode>(mode);
if (!cfbsBitmap || cfbsBitmap->DisplayMode() == displayMode) if (!cfbsBitmap || cfbsBitmap->DisplayMode() == displayMode)
@ -1032,9 +1032,9 @@ void QS60PixmapData::convertToDisplayMode(int mode)
UPDATE_BUFFER(); UPDATE_BUFFER();
} }
QPixmapData *QS60PixmapData::createCompatiblePixmapData() const QPlatformPixmap *QS60PlatformPixmap::createCompatiblePlatformPixmap() const
{ {
return new QS60PixmapData(pixelType()); return new QS60PlatformPixmap(pixelType());
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -81,17 +81,17 @@ private:
bool wasLocked; bool wasLocked;
}; };
class QS60PixmapData : public QRasterPixmapData class QS60PlatformPixmap : public QRasterPlatformPixmap
{ {
public: public:
QS60PixmapData(PixelType type); QS60PlatformPixmap(PixelType type);
~QS60PixmapData(); ~QS60PlatformPixmap();
QPixmapData *createCompatiblePixmapData() const; QPlatformPixmap *createCompatiblePlatformPixmap() const;
void resize(int width, int height); void resize(int width, int height);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags); 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); bool scroll(int dx, int dy, const QRect &rect);
int metric(QPaintDevice::PaintDeviceMetric metric) const; int metric(QPaintDevice::PaintDeviceMetric metric) const;
@ -122,11 +122,11 @@ private:
bool formatLocked; bool formatLocked;
QS60PixmapData *next; QS60PlatformPixmap *next;
QS60PixmapData *prev; QS60PlatformPixmap *prev;
static void qt_symbian_register_pixmap(QS60PixmapData *pd); static void qt_symbian_register_pixmap(QS60PlatformPixmap *pd);
static void qt_symbian_unregister_pixmap(QS60PixmapData *pd); static void qt_symbian_unregister_pixmap(QS60PlatformPixmap *pd);
static void qt_symbian_release_pixmaps(); static void qt_symbian_release_pixmaps();
friend class QPixmap; friend class QPixmap;

View File

@ -125,8 +125,8 @@ HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const
return 0; return 0;
HBITMAP bitmap = 0; HBITMAP bitmap = 0;
if (data->classId() == QPixmapData::RasterClass) { if (data->classId() == QPlatformPixmap::RasterClass) {
QRasterPixmapData* d = static_cast<QRasterPixmapData*>(data.data()); QRasterPlatformPixmap* d = static_cast<QRasterPlatformPixmap*>(data.data());
int w = d->image.width(); int w = d->image.width();
int h = d->image.height(); 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); memcpy(pixels + y * bytes_per_line, image.scanLine(y), bytes_per_line);
} else { } else {
QPixmapData *data = new QRasterPixmapData(depth() == 1 ? QPlatformPixmap *data = new QRasterPlatformPixmap(depth() == 1 ?
QPixmapData::BitmapType : QPixmapData::PixmapType); QPlatformPixmap::BitmapType : QPlatformPixmap::PixmapType);
data->fromImage(toImage(), Qt::AutoColor); data->fromImage(toImage(), Qt::AutoColor);
return QPixmap(data).toWinHBITMAP(format); return QPixmap(data).toWinHBITMAP(format);
} }

View File

@ -539,8 +539,8 @@ void QCursorData::update()
fg.green = 0; fg.green = 0;
fg.blue = 0; fg.blue = 0;
QImage image = QApplicationPrivate::instance()->getPixmapCursor(cshape).toImage(); QImage image = QApplicationPrivate::instance()->getPixmapCursor(cshape).toImage();
pm = QX11PixmapData::createBitmapFromImage(image); pm = QX11PlatformPixmap::createBitmapFromImage(image);
pmm = QX11PixmapData::createBitmapFromImage(image.createAlphaMask().convertToFormat(QImage::Format_MonoLSB)); pmm = QX11PlatformPixmap::createBitmapFromImage(image.createAlphaMask().convertToFormat(QImage::Format_MonoLSB));
hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8); hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8);
} }

View File

@ -641,7 +641,7 @@ QBitmap QFontEngineXLFD::bitmapForGlyphs(const QGlyphLayout &glyphs, const glyph
if (w <= 0 || h <= 0) if (w <= 0 || h <= 0)
return QBitmap(); return QBitmap();
QPixmapData *data = new QX11PixmapData(QPixmapData::BitmapType); QPlatformPixmap *data = new QX11PlatformPixmap(QPlatformPixmap::BitmapType);
data->resize(w, h); data->resize(w, h);
QPixmap bm(data); QPixmap bm(data);
QPainter p(&bm); QPainter p(&bm);

View File

@ -487,7 +487,7 @@ bool QX11PaintEngine::begin(QPaintDevice *pdev)
d->picture = (::Picture)w->x11PictureHandle(); d->picture = (::Picture)w->x11PictureHandle();
} else if (pdev->devType() == QInternal::Pixmap) { } else if (pdev->devType() == QInternal::Pixmap) {
const QPixmap *pm = static_cast<const QPixmap *>(pdev); const QPixmap *pm = static_cast<const QPixmap *>(pdev);
QX11PixmapData *data = static_cast<QX11PixmapData*>(pm->data.data()); QX11PlatformPixmap *data = static_cast<QX11PlatformPixmap*>(pm->data.data());
if (X11->use_xrender && data->depth() != 32 && data->x11_mask) if (X11->use_xrender && data->depth() != 32 && data->x11_mask)
data->convertToARGB32(); data->convertToARGB32();
d->picture = (::Picture)static_cast<const QPixmap *>(pdev)->x11PictureHandle(); d->picture = (::Picture)static_cast<const QPixmap *>(pdev)->x11PictureHandle();
@ -1370,7 +1370,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin)
XRenderPictureAttributes attrs; XRenderPictureAttributes attrs;
attrs.repeat = true; attrs.repeat = true;
XRenderChangePicture(d->dpy, d->brush_pm.x11PictureHandle(), CPRepeat, &attrs); XRenderChangePicture(d->dpy, d->brush_pm.x11PictureHandle(), CPRepeat, &attrs);
QX11PixmapData *data = static_cast<QX11PixmapData*>(d->brush_pm.data.data()); QX11PlatformPixmap *data = static_cast<QX11PlatformPixmap*>(d->brush_pm.data.data());
if (data->mask_picture) if (data->mask_picture)
XRenderChangePicture(d->dpy, data->mask_picture, CPRepeat, &attrs); 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 #ifndef QT_NO_XRENDER
if (d->pdev_depth == 32 && d->brush_pm.depth() != 32) { if (d->pdev_depth == 32 && d->brush_pm.depth() != 32) {
d->brush_pm.detach(); d->brush_pm.detach();
QX11PixmapData *brushData = static_cast<QX11PixmapData*>(d->brush_pm.data.data()); QX11PlatformPixmap *brushData = static_cast<QX11PlatformPixmap*>(d->brush_pm.data.data());
brushData->convertToARGB32(); brushData->convertToARGB32();
} }
#endif #endif
vals.tile = (d->brush_pm.depth() == d->pdev_depth vals.tile = (d->brush_pm.depth() == d->pdev_depth
? d->brush_pm.handle() ? d->brush_pm.handle()
: static_cast<QX11PixmapData*>(d->brush_pm.data.data())->x11ConvertToDefaultDepth()); : static_cast<QX11PlatformPixmap*>(d->brush_pm.data.data())->x11ConvertToDefaultDepth());
s = FillTiled; s = FillTiled;
#if !defined(QT_NO_XRENDER) #if !defined(QT_NO_XRENDER)
d->current_brush = d->cbrush.texture().x11PictureHandle(); 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()); QPixmap::x11SetDefaultScreen(pixmap.x11Info().screen());
#ifndef QT_NO_XRENDER #ifndef QT_NO_XRENDER
::Picture src_pict = static_cast<QX11PixmapData*>(pixmap.data.data())->picture; ::Picture src_pict = static_cast<QX11PlatformPixmap*>(pixmap.data.data())->picture;
if (src_pict && d->picture) { if (src_pict && d->picture) {
const int pDepth = pixmap.depth(); const int pDepth = pixmap.depth();
if (pDepth == 1 && (d->has_alpha_pen)) { 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 mono_dst = d->pdev_depth == 1;
bool restore_clip = false; bool restore_clip = false;
if (static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask) { // pixmap has a mask if (static_cast<QX11PlatformPixmap*>(pixmap.data.data())->x11_mask) { // pixmap has a mask
QBitmap comb(sw, sh); QBitmap comb(sw, sh);
GC cgc = XCreateGC(d->dpy, comb.handle(), 0, 0); GC cgc = XCreateGC(d->dpy, comb.handle(), 0, 0);
XSetForeground(d->dpy, cgc, 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); XSetFillStyle(d->dpy, cgc, FillOpaqueStippled);
XSetTSOrigin(d->dpy, cgc, -sx, -sy); XSetTSOrigin(d->dpy, cgc, -sx, -sy);
XSetStipple(d->dpy, cgc, XSetStipple(d->dpy, cgc,
static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask); static_cast<QX11PlatformPixmap*>(pixmap.data.data())->x11_mask);
XFillRectangle(d->dpy, comb.handle(), cgc, 0, 0, sw, sh); XFillRectangle(d->dpy, comb.handle(), cgc, 0, 0, sw, sh);
XFreeGC(d->dpy, cgc); 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) { if (d->pdev->devType() == QInternal::Pixmap) {
const QPixmap *px = static_cast<const QPixmap*>(d->pdev); const QPixmap *px = static_cast<const QPixmap*>(d->pdev);
Pixmap src_mask = static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask; Pixmap src_mask = static_cast<QX11PlatformPixmap*>(pixmap.data.data())->x11_mask;
Pixmap dst_mask = static_cast<QX11PixmapData*>(px->data.data())->x11_mask; Pixmap dst_mask = static_cast<QX11PlatformPixmap*>(px->data.data())->x11_mask;
if (dst_mask) { if (dst_mask) {
GC cgc = XCreateGC(d->dpy, dst_mask, 0, 0); GC cgc = XCreateGC(d->dpy, dst_mask, 0, 0);
if (src_mask) { // copy src mask into dst mask if (src_mask) { // copy src mask into dst mask
@ -2222,7 +2222,7 @@ void QX11PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, co
#endif #endif
} else } else
#endif // !QT_NO_XRENDER #endif // !QT_NO_XRENDER
if (pixmap.depth() > 1 && !static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask) { if (pixmap.depth() > 1 && !static_cast<QX11PlatformPixmap*>(pixmap.data.data())->x11_mask) {
XSetTile(d->dpy, d->gc, pixmap.handle()); XSetTile(d->dpy, d->gc, pixmap.handle());
XSetFillStyle(d->dpy, d->gc, FillTiled); XSetFillStyle(d->dpy, d->gc, FillTiled);
XSetTSOrigin(d->dpy, d->gc, x-sx, y-sy); 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 const bool xrenderPath = (X11->use_xrender
&& !(d->pdev->devType() == QInternal::Pixmap && !(d->pdev->devType() == QInternal::Pixmap
&& static_cast<const QPixmap *>(d->pdev)->data->pixelType() == QPixmapData::BitmapType)); && static_cast<const QPixmap *>(d->pdev)->data->pixelType() == QPlatformPixmap::BitmapType));
QVarLengthArray<QFixedPoint> positions; QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs; QVarLengthArray<glyph_t> glyphs;

View File

@ -80,10 +80,10 @@ QT_BEGIN_NAMESPACE
QPixmap qt_toX11Pixmap(const QImage &image) QPixmap qt_toX11Pixmap(const QImage &image)
{ {
QPixmapData *data = QPlatformPixmap *data =
new QX11PixmapData(image.depth() == 1 new QX11PlatformPixmap(image.depth() == 1
? QPixmapData::BitmapType ? QPlatformPixmap::BitmapType
: QPixmapData::PixmapType); : QPlatformPixmap::PixmapType);
data->fromImage(image, Qt::AutoColor); data->fromImage(image, Qt::AutoColor);
@ -95,7 +95,7 @@ QPixmap qt_toX11Pixmap(const QPixmap &pixmap)
if (pixmap.isNull()) if (pixmap.isNull())
return QPixmap(); return QPixmap();
if (QPixmap(pixmap).data_ptr()->classId() == QPixmapData::X11Class) if (QPixmap(pixmap).data_ptr()->classId() == QPlatformPixmap::X11Class)
return pixmap; return pixmap;
return qt_toX11Pixmap(pixmap.toImage()); return qt_toX11Pixmap(pixmap.toImage());
@ -113,7 +113,7 @@ inline static void qSafeXDestroyImage(XImage *x)
XDestroyImage(x); XDestroyImage(x);
} }
QBitmap QX11PixmapData::mask_to_bitmap(int screen) const QBitmap QX11PlatformPixmap::mask_to_bitmap(int screen) const
{ {
if (!x11_mask) if (!x11_mask)
return QBitmap(); return QBitmap();
@ -126,7 +126,7 @@ QBitmap QX11PixmapData::mask_to_bitmap(int screen) const
return bm; 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()) if (bitmap.isNull())
return 0; return 0;
@ -313,19 +313,19 @@ static int defaultScreen = -1;
QBasicAtomicInt qt_pixmap_serial = Q_BASIC_ATOMIC_INITIALIZER(0); QBasicAtomicInt qt_pixmap_serial = Q_BASIC_ATOMIC_INITIALIZER(0);
int Q_WIDGETS_EXPORT qt_x11_preferred_pixmap_depth = 0; int Q_WIDGETS_EXPORT qt_x11_preferred_pixmap_depth = 0;
QX11PixmapData::QX11PixmapData(PixelType type) QX11PlatformPixmap::QX11PlatformPixmap(PixelType type)
: QPixmapData(type, X11Class), gl_surface(0), hd(0), : QPlatformPixmap(type, X11Class), gl_surface(0), hd(0),
flags(Uninitialized), x11_mask(0), picture(0), mask_picture(0), hd2(0), flags(Uninitialized), x11_mask(0), picture(0), mask_picture(0), hd2(0),
share_mode(QPixmap::ImplicitlyShared), pengine(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)); setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1));
@ -407,7 +407,7 @@ struct QX11AlphaDetector
mutable bool has; mutable bool has;
}; };
void QX11PixmapData::fromImage(const QImage &img, void QX11PlatformPixmap::fromImage(const QImage &img,
Qt::ImageConversionFlags flags) Qt::ImageConversionFlags flags)
{ {
setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); 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); QImage img = image.convertToFormat(QImage::Format_MonoLSB);
const QRgb c0 = QColor(Qt::black).rgb(); const QRgb c0 = QColor(Qt::black).rgb();
@ -1183,7 +1183,7 @@ Qt::HANDLE QX11PixmapData::createBitmapFromImage(const QImage &image)
return hd; return hd;
} }
void QX11PixmapData::bitmapFromImage(const QImage &image) void QX11PlatformPixmap::bitmapFromImage(const QImage &image)
{ {
w = image.width(); w = image.width();
h = image.height(); h = image.height();
@ -1197,7 +1197,7 @@ void QX11PixmapData::bitmapFromImage(const QImage &image)
#endif // QT_NO_XRENDER #endif // QT_NO_XRENDER
} }
void QX11PixmapData::fill(const QColor &fillColor) void QX11PlatformPixmap::fill(const QColor &fillColor)
{ {
if (fillColor.alpha() != 255) { if (fillColor.alpha() != 255) {
#ifndef QT_NO_XRENDER #ifndef QT_NO_XRENDER
@ -1233,18 +1233,18 @@ void QX11PixmapData::fill(const QColor &fillColor)
XFreeGC(X11->display, gc); XFreeGC(X11->display, gc);
} }
QX11PixmapData::~QX11PixmapData() QX11PlatformPixmap::~QX11PlatformPixmap()
{ {
// Cleanup hooks have to be called before the handles are freed // Cleanup hooks have to be called before the handles are freed
if (is_cached) { if (is_cached) {
QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(this); QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(this);
is_cached = false; is_cached = false;
} }
release(); release();
} }
void QX11PixmapData::release() void QX11PlatformPixmap::release()
{ {
delete pengine; delete pengine;
pengine = 0; pengine = 0;
@ -1283,7 +1283,7 @@ void QX11PixmapData::release()
} }
} }
QPixmap QX11PixmapData::alphaChannel() const QPixmap QX11PlatformPixmap::alphaChannel() const
{ {
if (!hasAlphaChannel()) { if (!hasAlphaChannel()) {
QPixmap pm(w, h); QPixmap pm(w, h);
@ -1294,7 +1294,7 @@ QPixmap QX11PixmapData::alphaChannel() const
return QPixmap::fromImage(im.alphaChannel(), Qt::OrderedDither); return QPixmap::fromImage(im.alphaChannel(), Qt::OrderedDither);
} }
void QX11PixmapData::setAlphaChannel(const QPixmap &alpha) void QX11PlatformPixmap::setAlphaChannel(const QPixmap &alpha)
{ {
QImage image(toImage()); QImage image(toImage());
image.setAlphaChannel(alpha.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; QBitmap mask;
#ifndef QT_NO_XRENDER #ifndef QT_NO_XRENDER
@ -1313,7 +1313,7 @@ QBitmap QX11PixmapData::mask() const
} else } else
#endif #endif
if (d == 1) { if (d == 1) {
QX11PixmapData *that = const_cast<QX11PixmapData*>(this); QX11PlatformPixmap *that = const_cast<QX11PlatformPixmap*>(this);
mask = QPixmap(that); mask = QPixmap(that);
} else { } else {
mask = mask_to_bitmap(xinfo.screen()); mask = mask_to_bitmap(xinfo.screen());
@ -1342,12 +1342,12 @@ QBitmap QX11PixmapData::mask() const
\sa mask(), {QPixmap#Pixmap Transformations}{Pixmap \sa mask(), {QPixmap#Pixmap Transformations}{Pixmap
Transformations}, QBitmap Transformations}, QBitmap
*/ */
void QX11PixmapData::setMask(const QBitmap &newmask) void QX11PlatformPixmap::setMask(const QBitmap &newmask)
{ {
if (newmask.isNull()) { // clear mask if (newmask.isNull()) { // clear mask
#ifndef QT_NO_XRENDER #ifndef QT_NO_XRENDER
if (picture && d == 32) { if (picture && d == 32) {
QX11PixmapData newData(pixelType()); QX11PlatformPixmap newData(pixelType());
newData.resize(w, h); newData.resize(w, h);
newData.fill(Qt::black); newData.fill(Qt::black);
XRenderComposite(X11->display, PictOpOver, XRenderComposite(X11->display, PictOpOver,
@ -1355,11 +1355,11 @@ void QX11PixmapData::setMask(const QBitmap &newmask)
0, 0, 0, 0, 0, 0, w, h); 0, 0, 0, 0, 0, 0, w, h);
release(); release();
*this = newData; *this = newData;
// the new QX11PixmapData object isn't referenced yet, so // the new QX11PlatformPixmap object isn't referenced yet, so
// ref it // ref it
ref.ref(); 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 // doesn't delete our newly created render picture
newData.hd = 0; newData.hd = 0;
newData.x11_mask = 0; newData.x11_mask = 0;
@ -1409,7 +1409,7 @@ void QX11PixmapData::setMask(const QBitmap &newmask)
XRenderFreePicture(X11->display, mask_picture); XRenderFreePicture(X11->display, mask_picture);
#endif #endif
} }
x11_mask = QX11PixmapData::bitmap_to_mask(newmask, xinfo.screen()); x11_mask = QX11PlatformPixmap::bitmap_to_mask(newmask, xinfo.screen());
#ifndef QT_NO_XRENDER #ifndef QT_NO_XRENDER
if (picture) { if (picture) {
mask_picture = XRenderCreatePicture(X11->display, x11_mask, 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) { switch (metric) {
case QPaintDevice::PdmWidth: case QPaintDevice::PdmWidth:
@ -1452,7 +1452,7 @@ int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
case QPaintDevice::PdmPhysicalDpiY: case QPaintDevice::PdmPhysicalDpiY:
return QX11Info::appDpiY(xinfo.screen()); return QX11Info::appDpiY(xinfo.screen());
default: default:
qWarning("QX11PixmapData::metric(): Invalid metric"); qWarning("QX11PlatformPixmap::metric(): Invalid metric");
return 0; return 0;
} }
} }
@ -1462,7 +1462,7 @@ struct QXImageWrapper
XImage *xi; XImage *xi;
}; };
bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) const bool QX11PlatformPixmap::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) const
{ {
XImage *xi = xiWrapper.xi; XImage *xi = xiWrapper.xi;
@ -1485,7 +1485,7 @@ bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) co
return false; return false;
} }
QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) const QImage QX11PlatformPixmap::takeQImageFromXImage(const QXImageWrapper &xiWrapper) const
{ {
XImage *xi = xiWrapper.xi; XImage *xi = xiWrapper.xi;
@ -1538,7 +1538,7 @@ QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) con
return image; return image;
} }
QImage QX11PixmapData::toImage(const QRect &rect) const QImage QX11PlatformPixmap::toImage(const QRect &rect) const
{ {
QXImageWrapper xiWrapper; QXImageWrapper xiWrapper;
xiWrapper.xi = XGetImage(X11->display, hd, rect.x(), rect.y(), rect.width(), rect.height(), 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} \sa fromImage(), {QImage#Image Formats}{Image Formats}
*/ */
QImage QX11PixmapData::toImage() const QImage QX11PlatformPixmap::toImage() const
{ {
return toImage(QRect(0, 0, w, h)); 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; XImage *xi = xiWrapper.xi;
@ -1852,7 +1852,7 @@ QImage QX11PixmapData::toImage(const QXImageWrapper &xiWrapper, const QRect &rec
\sa trueMatrix(), {QPixmap#Pixmap Transformations}{Pixmap \sa trueMatrix(), {QPixmap#Pixmap Transformations}{Pixmap
Transformations} Transformations}
*/ */
QPixmap QX11PixmapData::transformed(const QTransform &transform, QPixmap QX11PlatformPixmap::transformed(const QTransform &transform,
Qt::TransformationMode mode ) const Qt::TransformationMode mode ) const
{ {
if (mode == Qt::SmoothTransformation || transform.type() >= QTransform::TxProject) { if (mode == Qt::SmoothTransformation || transform.type() >= QTransform::TxProject) {
@ -2002,9 +2002,9 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform,
free(dptr); free(dptr);
return bm; return bm;
} else { // color pixmap } else { // color pixmap
QX11PixmapData *x11Data = new QX11PixmapData(QPixmapData::PixmapType); QX11PlatformPixmap *x11Data = new QX11PlatformPixmap(QPlatformPixmap::PixmapType);
QPixmap pm(x11Data); QPixmap pm(x11Data);
x11Data->flags &= ~QX11PixmapData::Uninitialized; x11Data->flags &= ~QX11PlatformPixmap::Uninitialized;
x11Data->xinfo = xinfo; x11Data->xinfo = xinfo;
x11Data->d = d; x11Data->d = d;
x11Data->w = w; x11Data->w = w;
@ -2067,13 +2067,13 @@ void QPixmap::x11SetScreen(int screen)
if (isNull()) if (isNull())
return; return;
if (data->classId() != QPixmapData::X11Class) if (data->classId() != QPlatformPixmap::X11Class)
return; return;
if (screen < 0) if (screen < 0)
screen = QX11Info::appScreen(); screen = QX11Info::appScreen();
QX11PixmapData *x11Data = static_cast<QX11PixmapData*>(data.data()); QX11PlatformPixmap *x11Data = static_cast<QX11PlatformPixmap*>(data.data());
if (screen == x11Data->xinfo.screen()) if (screen == x11Data->xinfo.screen())
return; // nothing to do 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; 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); void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const XWindowAttributes &a);
qt_x11_getX11InfoForWindow(&data->xinfo,window_attr); 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); QPixmap pm(data);
data->flags &= ~QX11PixmapData::Uninitialized; data->flags &= ~QX11PlatformPixmap::Uninitialized;
pm.x11SetScreen(scr); pm.x11SetScreen(scr);
GC gc = XCreateGC(dpy, pm.handle(), 0, 0); 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; return pm;
} }
bool QX11PixmapData::hasAlphaChannel() const bool QX11PlatformPixmap::hasAlphaChannel() const
{ {
return d == 32; return d == 32;
} }
const QX11Info &QPixmap::x11Info() const const QX11Info &QPixmap::x11Info() const
{ {
if (data && data->classId() == QPixmapData::X11Class) if (data && data->classId() == QPlatformPixmap::X11Class)
return static_cast<QX11PixmapData*>(data.data())->xinfo; return static_cast<QX11PlatformPixmap*>(data.data())->xinfo;
else { else {
static QX11Info nullX11Info; static QX11Info nullX11Info;
return nullX11Info; return nullX11Info;
@ -2189,9 +2189,9 @@ static XRenderPictFormat *qt_renderformat_for_depth(const QX11Info &xinfo, int d
} }
#endif #endif
QPaintEngine* QX11PixmapData::paintEngine() const QPaintEngine* QX11PlatformPixmap::paintEngine() const
{ {
QX11PixmapData *that = const_cast<QX11PixmapData*>(this); QX11PlatformPixmap *that = const_cast<QX11PlatformPixmap*>(this);
if ((flags & Readonly) && share_mode == QPixmap::ImplicitlyShared) { if ((flags & Readonly) && share_mode == QPixmap::ImplicitlyShared) {
// if someone wants to draw onto us, copy the shared contents // if someone wants to draw onto us, copy the shared contents
@ -2215,7 +2215,7 @@ QPaintEngine* QX11PixmapData::paintEngine() const
XFreeGC(X11->display, gc); XFreeGC(X11->display, gc);
} }
that->hd = hd_copy; that->hd = hd_copy;
that->flags &= ~QX11PixmapData::Readonly; that->flags &= ~QX11PlatformPixmap::Readonly;
} }
if (!that->pengine) if (!that->pengine)
@ -2226,8 +2226,8 @@ QPaintEngine* QX11PixmapData::paintEngine() const
Qt::HANDLE QPixmap::x11PictureHandle() const Qt::HANDLE QPixmap::x11PictureHandle() const
{ {
#ifndef QT_NO_XRENDER #ifndef QT_NO_XRENDER
if (data && data->classId() == QPixmapData::X11Class) if (data && data->classId() == QPlatformPixmap::X11Class)
return static_cast<const QX11PixmapData*>(data.data())->picture; return static_cast<const QX11PlatformPixmap*>(data.data())->picture;
else else
return 0; return 0;
#else #else
@ -2235,7 +2235,7 @@ Qt::HANDLE QPixmap::x11PictureHandle() const
#endif // QT_NO_XRENDER #endif // QT_NO_XRENDER
} }
Qt::HANDLE QX11PixmapData::x11ConvertToDefaultDepth() Qt::HANDLE QX11PlatformPixmap::x11ConvertToDefaultDepth()
{ {
#ifndef QT_NO_XRENDER #ifndef QT_NO_XRENDER
if (d == QX11Info::appDepth() || !X11->use_xrender) if (d == QX11Info::appDepth() || !X11->use_xrender)
@ -2255,14 +2255,14 @@ Qt::HANDLE QX11PixmapData::x11ConvertToDefaultDepth()
#endif #endif
} }
void QX11PixmapData::copy(const QPixmapData *data, const QRect &rect) void QX11PlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect)
{ {
if (data->pixelType() == BitmapType) { if (data->pixelType() == BitmapType) {
fromImage(data->toImage().copy(rect), Qt::AutoColor); fromImage(data->toImage().copy(rect), Qt::AutoColor);
return; return;
} }
const QX11PixmapData *x11Data = static_cast<const QX11PixmapData*>(data); const QX11PlatformPixmap *x11Data = static_cast<const QX11PlatformPixmap*>(data);
setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); 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); GC gc = XCreateGC(X11->display, hd, 0, 0);
XCopyArea(X11->display, hd, hd, gc, 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) #if !defined(QT_NO_XRENDER)
void QX11PixmapData::convertToARGB32(bool preserveContents) void QX11PlatformPixmap::convertToARGB32(bool preserveContents)
{ {
if (!X11->use_xrender) if (!X11->use_xrender)
return; return;
@ -2383,9 +2383,9 @@ QPixmap QPixmap::fromX11Pixmap(Qt::HANDLE pixmap, QPixmap::ShareMode mode)
break; 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->setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1));
data->flags = QX11PixmapData::Readonly; data->flags = QX11PlatformPixmap::Readonly;
data->share_mode = mode; data->share_mode = mode;
data->w = width; data->w = width;
data->h = height; data->h = height;

View File

@ -53,8 +53,8 @@
// We mean it. // We mean it.
// //
#include <QtGui/private/qpixmapdata_p.h> #include <QtGui/qplatformpixmap_qpa.h>
#include <QtGui/private/qpixmapdatafactory_p.h> #include <QtGui/qplatformpixmapfactory_p.h>
#include "QtGui/qx11info_x11.h" #include "QtGui/qx11info_x11.h"
@ -64,20 +64,20 @@ class QX11PaintEngine;
struct QXImageWrapper; struct QXImageWrapper;
class Q_WIDGETS_EXPORT QX11PixmapData : public QPixmapData class Q_WIDGETS_EXPORT QX11PlatformPixmap : public QPlatformPixmap
{ {
public: public:
QX11PixmapData(PixelType type); QX11PlatformPixmap(PixelType type);
// QX11PixmapData(PixelType type, int width, int height); // QX11PlatformPixmap(PixelType type, int width, int height);
// QX11PixmapData(PixelType type, const QImage &image, // QX11PlatformPixmap(PixelType type, const QImage &image,
// Qt::ImageConversionFlags flags); // Qt::ImageConversionFlags flags);
~QX11PixmapData(); ~QX11PlatformPixmap();
QPixmapData *createCompatiblePixmapData() const; QPlatformPixmap *createCompatiblePlatformPixmap() const;
void resize(int width, int height); void resize(int width, int height);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags); 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); bool scroll(int dx, int dy, const QRect &rect);
void fill(const QColor &color); void fill(const QColor &color);
@ -114,9 +114,9 @@ private:
friend class QGLContextPrivate; // Needs to access xinfo, gl_surface & flags friend class QGLContextPrivate; // Needs to access xinfo, gl_surface & flags
friend class QEglContext; // Needs gl_surface friend class QEglContext; // Needs gl_surface
friend class QGLContext; // Needs gl_surface friend class QGLContext; // Needs gl_surface
friend class QX11GLPixmapData; // Needs gl_surface friend class QX11GLPlatformPixmap; // Needs gl_surface
friend class QMeeGoLivePixmapData; // Needs gl_surface and flags friend class QMeeGoLivePlatformPixmap; // Needs gl_surface and flags
friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs gl_surface friend bool qt_createEGLSurfaceForPixmap(QPlatformPixmap*, bool); // Needs gl_surface
void release(); void release();

View File

@ -1400,7 +1400,7 @@ void QWidgetPrivate::updateSystemBackground()
else if (brush.style() == Qt::TexturePattern) { else if (brush.style() == Qt::TexturePattern) {
extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap); // qpixmap_x11.cpp extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap); // qpixmap_x11.cpp
XSetWindowBackgroundPixmap(X11->display, q->internalWinId(), XSetWindowBackgroundPixmap(X11->display, q->internalWinId(),
static_cast<QX11PixmapData*>(qt_toX11Pixmap(brush.texture()).data.data())->x11ConvertToDefaultDepth()); static_cast<QX11PlatformPixmap*>(qt_toX11Pixmap(brush.texture()).data.data())->x11ConvertToDefaultDepth());
} else } else
XSetWindowBackground(X11->display, q->internalWinId(), XSetWindowBackground(X11->display, q->internalWinId(),
QColormap::instance(xinfo.screen()).pixel(brush.color())); 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 // violates the ICCCM), since this works on all DEs known to Qt
if (!forceReset || !topData->iconPixmap) if (!forceReset || !topData->iconPixmap)
topData->iconPixmap = new QPixmap(qt_toX11Pixmap(icon.pixmap(QSize(64,64)))); topData->iconPixmap = new QPixmap(qt_toX11Pixmap(icon.pixmap(QSize(64,64))));
pixmap_handle = static_cast<QX11PixmapData*>(topData->iconPixmap->data.data())->x11ConvertToDefaultDepth(); pixmap_handle = static_cast<QX11PlatformPixmap*>(topData->iconPixmap->data.data())->x11ConvertToDefaultDepth();
} }
} }
} }

View File

@ -106,7 +106,7 @@ protected:
friend class QX11PaintEngine; friend class QX11PaintEngine;
friend class QPixmap; friend class QPixmap;
friend class QX11PixmapData; friend class QX11PlatformPixmap;
friend class QWidget; friend class QWidget;
friend class QWidgetPrivate; friend class QWidgetPrivate;
friend class QGLWidget; friend class QGLWidget;

View File

@ -647,17 +647,17 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask
return QPixmap(); return QPixmap();
QPixmap pixmap; QPixmap pixmap;
QScopedPointer<QPixmapData> pd(QPixmapData::create(0, 0, QPixmapData::PixmapType)); QScopedPointer<QPlatformPixmap> pd(QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType));
if (mask) { if (mask) {
// Try the efficient path with less copying and conversion. // Try the efficient path with less copying and conversion.
QVolatileImage img(icon, mask); QVolatileImage img(icon, mask);
pd->fromNativeType(&img, QPixmapData::VolatileImage); pd->fromNativeType(&img, QPlatformPixmap::VolatileImage);
if (!pd->isNull()) if (!pd->isNull())
pixmap = QPixmap(pd.take()); pixmap = QPixmap(pd.take());
} }
if (pixmap.isNull()) { if (pixmap.isNull()) {
// Potentially more expensive path. // Potentially more expensive path.
pd->fromNativeType(icon, QPixmapData::FbsBitmap); pd->fromNativeType(icon, QPlatformPixmap::FbsBitmap);
pixmap = QPixmap(pd.take()); pixmap = QPixmap(pd.take());
if (mask) { if (mask) {
pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask)); pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask));

View File

@ -56,8 +56,8 @@ QPixmap pixmapFromNativeImageHandleProvider(QNativeImageHandleProvider *source)
#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG)
if (!source) if (!source)
return QPixmap(); return QPixmap();
QScopedPointer<QPixmapData> pd(QPixmapData::create(0, 0, QPixmapData::PixmapType)); QScopedPointer<QPlatformPixmap> pd(QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType));
pd->fromNativeType(source, QPixmapData::NativeImageHandleProvider); pd->fromNativeType(source, QPlatformPixmap::NativeImageHandleProvider);
return QPixmap(pd.take()); return QPixmap(pd.take());
#else #else
Q_UNUSED(source); Q_UNUSED(source);
@ -136,7 +136,7 @@ void tst_NativeImageHandleProvider::create()
QPixmap pm = pixmapFromNativeImageHandleProvider(0); QPixmap pm = pixmapFromNativeImageHandleProvider(0);
QVERIFY(pm.isNull()); QVERIFY(pm.isNull());
QPixmap tmp(10, 20); QPixmap tmp(10, 20);
if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { if (tmp.handle()->classId() == QPlatformPixmap::OpenVGClass) {
// Verify that null pixmap is properly returned when get() provides bogus results. // Verify that null pixmap is properly returned when get() provides bogus results.
DummyProvider prov; DummyProvider prov;
pm = pixmapFromNativeImageHandleProvider(&prov); pm = pixmapFromNativeImageHandleProvider(&prov);
@ -151,7 +151,7 @@ void tst_NativeImageHandleProvider::bitmap()
{ {
#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG)
QPixmap tmp(10, 20); QPixmap tmp(10, 20);
if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { if (tmp.handle()->classId() == QPlatformPixmap::OpenVGClass) {
BitmapProvider prov; BitmapProvider prov;
// This should fail because of null ptr. // This should fail because of null ptr.
@ -198,7 +198,7 @@ void tst_NativeImageHandleProvider::hibernate()
{ {
#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG)
QPixmap tmp(10, 20); QPixmap tmp(10, 20);
if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { if (tmp.handle()->classId() == QPlatformPixmap::OpenVGClass) {
BitmapProvider prov; BitmapProvider prov;
prov.bmp = new CFbsBitmap; prov.bmp = new CFbsBitmap;
QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone); QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone);
@ -206,7 +206,7 @@ void tst_NativeImageHandleProvider::hibernate()
QPixmap pm = pixmapFromNativeImageHandleProvider(&prov); QPixmap pm = pixmapFromNativeImageHandleProvider(&prov);
QCOMPARE(prov.refCount, 1); QCOMPARE(prov.refCount, 1);
QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pm.pixmapData()); QVGPlatformPixmap *vgpd = static_cast<QVGPlatformPixmap *>(pm.handle());
vgpd->hibernate(); vgpd->hibernate();
QCOMPARE(prov.refCount, 0); QCOMPARE(prov.refCount, 0);

View File

@ -55,8 +55,8 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#ifdef QT_BUILD_INTERNAL #ifdef QT_BUILD_INTERNAL
#include <qplatformpixmap_qpa.h>
#include <QtOpenGL/private/qgl_p.h> #include <QtOpenGL/private/qgl_p.h>
#include <QtGui/private/qpixmapdata_p.h>
#include <QtGui/private/qimage_p.h> #include <QtGui/private/qimage_p.h>
#include <QtGui/private/qimagepixmapcleanuphooks_p.h> #include <QtGui/private/qimagepixmapcleanuphooks_p.h>
#endif #endif

View File

@ -533,8 +533,8 @@ public:
void draw(QPainter *painter) void draw(QPainter *painter)
{ {
QVERIFY(sourcePixmap(Qt::LogicalCoordinates).pixmapData() == pixmap.pixmapData()); QVERIFY(sourcePixmap(Qt::LogicalCoordinates).handle() == pixmap.handle());
QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).pixmapData() == pixmap.pixmapData())); QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).handle() == pixmap.handle()));
++repaints; ++repaints;
} }

View File

@ -51,7 +51,7 @@
#include <qtreewidget.h> #include <qtreewidget.h>
#include <qsplashscreen.h> #include <qsplashscreen.h>
#include <private/qpixmapdata_p.h> #include <qplatformpixmap_qpa.h>
#include <private/qdrawhelper_p.h> #include <private/qdrawhelper_p.h>
#include <QSet> #include <QSet>
@ -299,7 +299,7 @@ void tst_QPixmap::fromImage()
const QPixmap pixmap = QPixmap::fromImage(image); const QPixmap pixmap = QPixmap::fromImage(image);
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if (pixmap.pixmapData()->classId() == QPixmapData::X11Class && !pixmap.x11PictureHandle()) if (pixmap.handle()->classId() == QPlatformPixmap::X11Class && !pixmap.x11PictureHandle())
QSKIP("Requires XRender support", SkipAll); QSKIP("Requires XRender support", SkipAll);
#endif #endif
const QImage result = pixmap.toImage(); const QImage result = pixmap.toImage();
@ -530,7 +530,7 @@ void tst_QPixmap::fill()
pm = QPixmap(400, 400); pm = QPixmap(400, 400);
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
if (!bitmap && pm.pixmapData()->classId() == QPixmapData::X11Class && !pm.x11PictureHandle()) if (!bitmap && pm.handle()->classId() == QPlatformPixmap::X11Class && !pm.x11PictureHandle())
QSKIP("Requires XRender support", SkipSingle); QSKIP("Requires XRender support", SkipSingle);
#endif #endif
@ -560,7 +560,7 @@ void tst_QPixmap::fill_transparent()
{ {
QPixmap pixmap(10, 10); QPixmap pixmap(10, 10);
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if (pixmap.pixmapData()->classId() == QPixmapData::X11Class && !pixmap.x11PictureHandle()) if (pixmap.handle()->classId() == QPlatformPixmap::X11Class && !pixmap.x11PictureHandle())
QSKIP("Requires XRender support", SkipAll); QSKIP("Requires XRender support", SkipAll);
#endif #endif
pixmap.fill(Qt::transparent); pixmap.fill(Qt::transparent);
@ -861,7 +861,7 @@ void tst_QPixmap::isNull()
void tst_QPixmap::convertFromImageNoDetach() void tst_QPixmap::convertFromImageNoDetach()
{ {
QPixmap randomPixmap(10, 10); QPixmap randomPixmap(10, 10);
if (randomPixmap.pixmapData()->classId() != QPixmapData::RasterClass) if (randomPixmap.handle()->classId() != QPlatformPixmap::RasterClass)
QSKIP("Test only valid for raster pixmaps", SkipAll); QSKIP("Test only valid for raster pixmaps", SkipAll);
//first get the screen format //first get the screen format
@ -1431,7 +1431,7 @@ void tst_QPixmap::fromImage_crash()
delete img; delete img;
} }
//This is testing QPixmapData::createCompatiblePixmapData - see QTBUG-5977 //This is testing QPlatformPixmap::createCompatiblePlatformPixmap - see QTBUG-5977
void tst_QPixmap::splash_crash() void tst_QPixmap::splash_crash()
{ {
QPixmap pix; QPixmap pix;
@ -1673,10 +1673,10 @@ void tst_QPixmap::toImageDeepCopy()
#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG)
Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap); Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap);
class FriendlyVGPixmapData : public QVGPixmapData class FriendlyVGPlatformPixmap : public QVGPlatformPixmap
{ {
public: public:
FriendlyVGPixmapData(PixelType type) : QVGPixmapData(type) { } FriendlyVGPlatformPixmap(PixelType type) : QVGPlatformPixmap(type) { }
bool sourceIsNull() { return source.isNull(); } bool sourceIsNull() { return source.isNull(); }
friend QPixmap pixmapFromVGImage(VGImage image); friend QPixmap pixmapFromVGImage(VGImage image);
}; };
@ -1685,7 +1685,7 @@ QPixmap pixmapFromVGImage(VGImage image)
if (image != VG_INVALID_HANDLE) { if (image != VG_INVALID_HANDLE) {
int w = vgGetParameteri(image, VG_IMAGE_WIDTH); int w = vgGetParameteri(image, VG_IMAGE_WIDTH);
int h = vgGetParameteri(image, VG_IMAGE_HEIGHT); int h = vgGetParameteri(image, VG_IMAGE_HEIGHT);
FriendlyVGPixmapData *pd = new FriendlyVGPixmapData(QPixmapData::PixmapType); FriendlyVGPlatformPixmap *pd = new FriendlyVGPlatformPixmap(QPlatformPixmap::PixmapType);
pd->resize(w, h); pd->resize(w, h);
pd->vgImage = image; pd->vgImage = image;
pd->recreate = false; pd->recreate = false;
@ -1714,12 +1714,12 @@ public:
} else { // second phase: check if readback works } else { // second phase: check if readback works
painter.drawPixmap(0, 0, pm); painter.drawPixmap(0, 0, pm);
// Drawing should not cause readback, this is important for performance; // Drawing should not cause readback, this is important for performance;
noreadback_ok = static_cast<FriendlyVGPixmapData *>(pm.pixmapData())->sourceIsNull(); noreadback_ok = static_cast<FriendlyVGPlatformPixmap *>(pm.handle())->sourceIsNull();
// However toImage() requires readback. // However toImage() requires readback.
QImage img = pm.toImage(); QImage img = pm.toImage();
readback_ok = img.width() == pm.width(); readback_ok = img.width() == pm.width();
readback_ok &= img.height() == pm.height(); readback_ok &= img.height() == pm.height();
readback_ok &= !static_cast<FriendlyVGPixmapData *>(pm.pixmapData())->sourceIsNull(); readback_ok &= !static_cast<FriendlyVGPlatformPixmap *>(pm.handle())->sourceIsNull();
uint pix = img.pixel(1, 1); uint pix = img.pixel(1, 1);
content_ok = qRed(pix) == testPixel.red(); content_ok = qRed(pix) == testPixel.red();
content_ok &= qGreen(pix) == testPixel.green(); content_ok &= qGreen(pix) == testPixel.green();
@ -1741,7 +1741,7 @@ public:
void tst_QPixmap::vgImageReadBack() void tst_QPixmap::vgImageReadBack()
{ {
QPixmap tmp(10, 20); QPixmap tmp(10, 20);
if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { if (tmp.handle()->classId() == QPlatformPixmap::OpenVGClass) {
Content c; Content c;
c.w = 50; c.w = 50;
c.h = 60; c.h = 60;
@ -1755,7 +1755,7 @@ void tst_QPixmap::vgImageReadBack()
QCOMPARE(pm.width(), c.w); QCOMPARE(pm.width(), c.w);
QCOMPARE(pm.height(), c.h); QCOMPARE(pm.height(), c.h);
QVERIFY(qPixmapToVGImage(pm) == c.vgimage); QVERIFY(qPixmapToVGImage(pm) == c.vgimage);
QVERIFY(static_cast<FriendlyVGPixmapData *>(pm.pixmapData())->sourceIsNull()); QVERIFY(static_cast<FriendlyVGPlatformPixmap *>(pm.handle())->sourceIsNull());
c.pm = pm; c.pm = pm;
// Make sure the second phase in paintEvent is executed too. // Make sure the second phase in paintEvent is executed too.
c.hide(); c.hide();

View File

@ -76,8 +76,8 @@ Q_DECLARE_METATYPE(Qt::TransformationMode)
QPixmap rasterPixmap(int width, int height) QPixmap rasterPixmap(int width, int height)
{ {
QPixmapData *data = QPlatformPixmap *data =
new QRasterPixmapData(QPixmapData::PixmapType); new QRasterPlatformPixmap(QPlatformPixmap::PixmapType);
data->resize(width, height); data->resize(width, height);
@ -91,8 +91,8 @@ QPixmap rasterPixmap(const QSize &size)
QPixmap rasterPixmap(const QImage &image) QPixmap rasterPixmap(const QImage &image)
{ {
QPixmapData *data = QPlatformPixmap *data =
new QRasterPixmapData(QPixmapData::PixmapType); new QRasterPlatformPixmap(QPlatformPixmap::PixmapType);
data->fromImage(image, Qt::AutoColor); data->fromImage(image, Qt::AutoColor);

View File

@ -130,8 +130,8 @@ struct PrimitiveSet {
QPixmap rasterPixmap(int width, int height) QPixmap rasterPixmap(int width, int height)
{ {
QPixmapData *data = QPlatformPixmap *data =
new QRasterPixmapData(QPixmapData::PixmapType); new QRasterPlatformPixmap(QPlatformPixmap::PixmapType);
data->resize(width, height); data->resize(width, height);
@ -145,8 +145,8 @@ QPixmap rasterPixmap(const QSize &size)
QPixmap rasterPixmap(const QImage &image) QPixmap rasterPixmap(const QImage &image)
{ {
QPixmapData *data = QPlatformPixmap *data =
new QRasterPixmapData(QPixmapData::PixmapType); new QRasterPlatformPixmap(QPlatformPixmap::PixmapType);
data->fromImage(image, Qt::AutoColor); data->fromImage(image, Qt::AutoColor);