diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-07-21 07:58:25 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-07-22 10:05:41 (GMT) |
commit | 96f1f3d575a12967657bb534ee5accc04d52984e (patch) | |
tree | d2ff8af3d06d0f93afca04b39713ab4daf3709df /src | |
parent | 77d17d054b8baff411613206a099af36f8e0bc43 (diff) | |
download | Qt-96f1f3d575a12967657bb534ee5accc04d52984e.zip Qt-96f1f3d575a12967657bb534ee5accc04d52984e.tar.gz Qt-96f1f3d575a12967657bb534ee5accc04d52984e.tar.bz2 |
Removed createBlittable factory function from PlatformIntegration
and moved it onto QBlittablePixmap making the class abstract. The
creator function was seen as to spesialised to be part of the
PlatformIntegration class, and belonged to the QBlittablePixmap class
anyway since that was the PixmapData type you would need to return to
use the blitter api. Also removed the cross platform examples as they
are more confusing than anything else. For usage of QBlittable look in
the directfb platform integration plugin.
Diffstat (limited to 'src')
25 files changed, 21 insertions, 510 deletions
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index d91a269..9a7ebe2 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -14,8 +14,8 @@ QT_BEGIN_NAMESPACE static int global_ser_no = 0; -QBlittablePixmapData::QBlittablePixmapData(QPixmapData::PixelType type) - : QPixmapData(type,BlitterClass), m_engine(0), m_blittable(0) +QBlittablePixmapData::QBlittablePixmapData() + : QPixmapData(QPixmapData::PixmapType,BlitterClass), m_engine(0), m_blittable(0) #ifdef QT_BLITTER_RASTEROVERLAY ,m_rasterOverlay(0), m_unmergedCopy(0) #endif //QT_BLITTER_RASTEROVERLAY @@ -37,11 +37,7 @@ QBlittable *QBlittablePixmapData::blittable() const { if (!m_blittable) { QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this); -#ifdef Q_WS_QPA //####jl: graphics system nor platformintegration should have createBlittable - that->m_blittable = QApplicationPrivate::platformIntegration()->createBlittable(QSize(w,h)); -#else - that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QSize(w,h)); -#endif + that->m_blittable = this->createBlittable(QSize(w,h)); } return m_blittable; diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index b9f7630..e404199 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -11,9 +11,10 @@ class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData { // Q_DECLARE_PRIVATE(QBlittablePixmapData); public: - QBlittablePixmapData(QPixmapData::PixelType type); + QBlittablePixmapData(); ~QBlittablePixmapData(); + virtual QBlittable *createBlittable(const QSize &size) const = 0; QBlittable *blittable() const; void setBlittable(QBlittable *blittable); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 0602d82..de97f62 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -432,8 +432,10 @@ public: static QPalette *set_pal; static QGraphicsSystem *graphics_system; static QString graphics_system_name; - static QPlatformIntegration *platform_integration; static bool runtime_graphics_system; +#ifdef Q_WS_QPA + static QPlatformIntegration *platform_integration; +#endif private: static QFont *app_font; // private for a reason! Always use QApplication::font() instead! diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index b3f46ce..b4987f2 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -43,9 +43,6 @@ QT_BEGIN_NAMESPACE -QBlittable *QPlatformIntegration::createBlittable(const QSize &) const -{ return 0; } - QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const { Q_UNUSED(window); diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 11377e7..f6f10a8 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -66,7 +66,6 @@ public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0; - virtual QBlittable *createBlittable(const QSize &size) const; virtual void moveToScreen(QWidget *window, int screen) {Q_UNUSED(window); Q_UNUSED(screen);} // Window System functions @@ -77,6 +76,7 @@ public: // Experimental virtual QPlatformEventLoopIntegration *createEventLoopIntegration() const; +// should it be hasGLContext? virtual bool hasOpenGL() const; diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 7ef6598..92c4e84 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -125,16 +125,14 @@ embedded { painting/qgraphicssystem_runtime_p.h \ painting/qgraphicssystemfactory_p.h \ painting/qgraphicssystemplugin_p.h \ - painting/qwindowsurface_raster_p.h \ - painting/qwindowsurface_rasterblittable_p.h \ + painting/qwindowsurface_raster_p.h SOURCES += \ painting/qgraphicssystem_raster.cpp \ painting/qgraphicssystem_runtime.cpp \ painting/qgraphicssystemfactory.cpp \ painting/qgraphicssystemplugin.cpp \ - painting/qwindowsurface_raster.cpp \ - painting/qwindowsurface_rasterblittable.cpp \ + painting/qwindowsurface_raster.cpp } unix:x11 { diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h index 645f37e..71e80af 100644 --- a/src/gui/painting/qblittable_p.h +++ b/src/gui/painting/qblittable_p.h @@ -2,7 +2,8 @@ #define QBLITTABLE_P_H #include <QtCore/qsize.h> -#include <QtGui/qpixmap.h> +#include <QtGui/private/qpixmap_blitter_p.h> + #ifndef QT_NO_BLITTABLE QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index a03bdab..f594136 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -63,9 +63,6 @@ QGraphicsSystem::~QGraphicsSystem() { } -QBlittable *QGraphicsSystem::createBlittable(const QSize &) const -{ return 0; } - QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType type) { #ifdef Q_WS_QWS diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index 0d84886..a75ea61 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -70,7 +70,6 @@ public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QPixmapData *createPixmapData(QPixmapData *origin); virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; - virtual QBlittable *createBlittable(const QSize &size) const; virtual ~QGraphicsSystem(); diff --git a/src/gui/painting/qwindowsurface_rasterblittable.cpp b/src/gui/painting/qwindowsurface_rasterblittable.cpp deleted file mode 100644 index 56a79ba..0000000 --- a/src/gui/painting/qwindowsurface_rasterblittable.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "qwindowsurface_rasterblittable_p.h" - -#include <private/qpaintengine_blitter_p.h> -#include <private/qpixmap_blitter_p.h> - -QRasterBlittableWindowSurface::QRasterBlittableWindowSurface(QWidget *widget) - : QRasterWindowSurface(widget), - m_currentImage(0), - m_blittable(0), - m_pmData(new QBlittablePixmapData(QPixmapData::PixmapType)), - m_pixmap(new QPixmap(m_pmData)) -{ -} - -QPaintDevice *QRasterBlittableWindowSurface::paintDevice() -{ - QPaintDevice *device = QRasterWindowSurface::paintDevice(); - if (m_currentImage != device) { - if (device->devType() == QInternal::Image) { - m_currentImage = static_cast<QImage *>(device); - m_blittable = createBlittable(m_currentImage); - m_pmData->setBlittable(m_blittable); - } - } - return m_pixmap; -} diff --git a/src/gui/painting/qwindowsurface_rasterblittable_p.h b/src/gui/painting/qwindowsurface_rasterblittable_p.h deleted file mode 100644 index 1e697c7..0000000 --- a/src/gui/painting/qwindowsurface_rasterblittable_p.h +++ /dev/null @@ -1,21 +0,0 @@ -#include <private/qwindowsurface_raster_p.h> -#include <private/qpixmapdata_p.h> - -class QBlittable; -class QBlittablePixmapData; - -class Q_GUI_EXPORT QRasterBlittableWindowSurface : public QRasterWindowSurface -{ -public: - QRasterBlittableWindowSurface(QWidget *widget); - - virtual QBlittable *createBlittable(QImage *rasterSurface) = 0; - - QPaintDevice *paintDevice(); - -private: - QImage *m_currentImage; - QBlittable *m_blittable; - QBlittablePixmapData *m_pmData; - QPixmap *m_pixmap; -}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro b/src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro deleted file mode 100644 index d6a2018..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro +++ /dev/null @@ -1,28 +0,0 @@ -TARGET = qscreenblittablevfb -include(../../qpluginbase.pri) - -DEFINES += QT_QWS_QVFB QT_QWS_MOUSE_QVFB QT_QWS_KBD_QVFB - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers - -HEADERS = qgraphicssystem_blittableqvfb.h \ - qscreen_blittableqvfb.h \ - qwindowsurface_qwsblittable.h \ - qblittable_image.h - -SOURCES = main.cpp \ - qwindowsurface_qwsblittable.cpp - -#include qvfb sources -HEADERS += \ - $$QT_SOURCE_TREE/src/gui/embedded/qscreenvfb_qws.h \ - $$QT_SOURCE_TREE/src/gui/embedded/qkbdvfb_qws.h \ - $$QT_SOURCE_TREE/src/gui/embedded/qmousevfb_qws.h - -SOURCES += \ - $$QT_SOURCE_TREE/src/gui/embedded/qscreenvfb_qws.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qkbdvfb_qws.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qmousevfb_qws.cpp - -target.path += $$[QT_INSTALL_PLUGINS]/gfxdrivers -INSTALLS += target diff --git a/src/plugins/gfxdrivers/blittableqvfb/main.cpp b/src/plugins/gfxdrivers/blittableqvfb/main.cpp deleted file mode 100644 index b6d2603..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/main.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qscreendriverplugin_qws.h> -#include <qstringlist.h> -#include "qscreen_blittableqvfb.h" - -#ifndef QT_NO_LIBRARY -QT_BEGIN_NAMESPACE - -class ScreenBlittableVfbDriver : public QScreenDriverPlugin -{ -public: - ScreenBlittableVfbDriver(); - - QStringList keys() const; - QScreen *create(const QString&, int displayId); -}; - -ScreenBlittableVfbDriver::ScreenBlittableVfbDriver() -: QScreenDriverPlugin() -{ -} - -QStringList ScreenBlittableVfbDriver::keys() const -{ - QStringList list; - list << "BlittableQVFb"; - return list; -} - -QScreen* ScreenBlittableVfbDriver::create(const QString& driver, int displayId) -{ - if (driver.toLower() == "blittableqvfb") - return new QBlittableVFbScreen(displayId); - - return 0; -} - -Q_EXPORT_PLUGIN2(qscreenblittablevfb, ScreenBlittableVfbDriver) - -QT_END_NAMESPACE -#endif //QT_NO_LIBRARY diff --git a/src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h b/src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h deleted file mode 100644 index 3f8dc69..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h +++ /dev/null @@ -1,48 +0,0 @@ -#include <qimage.h> - -#include <private/qblittable_p.h> - - -class QImageBlittable : public QBlittable -{ -public: - QImageBlittable(QImage *image, bool deleteImage) - : QBlittable(image->size(), QBlittable::Capabilities(QBlittable::SolidRectCapability - |QBlittable::SourcePixmapCapability - |QBlittable::SourceOverPixmapCapability - |QBlittable::SourceOverScaledPixmapCapability)), - m_image(image), m_deleteImage(deleteImage) - { - - } - - ~QImageBlittable() { - if (m_deleteImage) - delete m_image; - } - - void fillRect(const QRectF &rect, const QColor &color) - { - QPainter p(lock()); - p.fillRect(rect,color); - } - void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &source) - { - //here it is possible to do a pixmap.pixmapData()->buffer() - //but is like this to show how to get the the blitter - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->width() && data->height()); - Q_ASSERT(data->classId() == QPixmapData::BlitterClass); - QBlittablePixmapData *blittableData = static_cast<QBlittablePixmapData*>(data); - - QPainter p(lock()); - p.drawImage(rect, *blittableData->blittable()->lock(),source); - } - -protected: - QImage *doLock() { return m_image; } - void doUnlock() { } -private: - QImage *m_image; - bool m_deleteImage; -}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h b/src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h deleted file mode 100644 index 89940d0..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h +++ /dev/null @@ -1,47 +0,0 @@ -#include <private/qgraphicssystem_p.h> -#include <private/qpixmap_blitter_p.h> -#include <private/qpixmap_raster_p.h> -#include <QScreen> - -#include "qwindowsurface_qwsblittable.h" -#include "qblittable_image.h" -#include <qapplication.h> - -class QBlittableVFbGraphicsSystem : public QGraphicsSystem -{ -public: - QPixmapData *createPixmapData(QPixmapData::PixelType type) const - { - if (type == QPixmapData::PixmapType) { - return new QBlittablePixmapData(type); - } else { - return new QRasterPixmapData(type); - } - } - - QWindowSurface *createWindowSurface(QWidget *widget) const - { - if (QApplication::type() == QApplication::GuiServer) - return new QWSBlittableMemSurface(widget); - else - return QScreen::instance()->createSurface(widget); - } - - QBlittable *createBlittable(const QSize &size) const - { - QImage *image = new QImage(size,QImage::Format_ARGB32); - return new QImageBlittable(image,true); - } - - static QGraphicsSystem *instance() - { - static QGraphicsSystem *system = 0; - if (!system) { - system = new QBlittableVFbGraphicsSystem; - } - return system; - } - -private: - QBlittableVFbGraphicsSystem() { } -}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h b/src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h deleted file mode 100644 index 645aeec..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h +++ /dev/null @@ -1,14 +0,0 @@ -#include <qscreenvfb_qws.h> -#include "qgraphicssystem_blittableqvfb.h" - -class QBlittableVFbScreen : public QVFbScreen -{ -public: - explicit QBlittableVFbScreen(int display_id) - : QVFbScreen(display_id) - { - setGraphicsSystem(QBlittableVFbGraphicsSystem::instance()); - - } - -}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.cpp b/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.cpp deleted file mode 100644 index e69de29..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.cpp +++ /dev/null diff --git a/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h b/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h deleted file mode 100644 index b955322..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h +++ /dev/null @@ -1,36 +0,0 @@ -#include "qblittable_image.h" - -#include <private/qpixmap_blitter_p.h> -#include <private/qwindowsurface_qws_p.h> - -class QBlittablePixmapData; - -class Q_GUI_EXPORT QWSBlittableMemSurface : public QWSLocalMemSurface -{ -public: - QWSBlittableMemSurface( QWidget *window ) - : QWSLocalMemSurface(window), - m_currentPaintDevice(0), - pmData(new QBlittablePixmapData(QPixmapData::PixmapType)), - pm(pmData) - { - } - - QPaintDevice *paintDevice() - { - if (QWSLocalMemSurface::paintDevice() != m_currentPaintDevice) { - QPaintDevice *device = QWSLocalMemSurface::paintDevice(); - if (device->devType() == QInternal::Image) { - img = *static_cast<QImage *>(device); - pmData->setBlittable(new QImageBlittable(&img,false)); - } - } - return ± - } - -private: - QPaintDevice *m_currentPaintDevice; - QBlittablePixmapData *pmData; - QPixmap pm; -}; - diff --git a/src/plugins/graphicssystems/blittable/blittable.pro b/src/plugins/graphicssystems/blittable/blittable.pro deleted file mode 100644 index 34c4165..0000000 --- a/src/plugins/graphicssystems/blittable/blittable.pro +++ /dev/null @@ -1,11 +0,0 @@ -TARGET = qblittablegraphicssystem -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -SOURCES = main.cpp -HEADERS = qblittable_image.h \ - qgraphicssystem_blittable.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/blittable/main.cpp b/src/plugins/graphicssystems/blittable/main.cpp deleted file mode 100644 index 06c3189..0000000 --- a/src/plugins/graphicssystems/blittable/main.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <private/qgraphicssystemplugin_p.h> - -#include "qgraphicssystem_blittable.h" - -QT_BEGIN_NAMESPACE - -class QBlittableGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QBlittableGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << QLatin1String("Blittable"); - return list; -} - -QGraphicsSystem* QBlittableGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == QLatin1String("blittable")) { - return new QBlittableGraphicsSystem; - } - - return 0; -} - -Q_EXPORT_PLUGIN2(blittable, QBlittableGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/blittable/qblittable_image.h b/src/plugins/graphicssystems/blittable/qblittable_image.h deleted file mode 100644 index 3f8dc69..0000000 --- a/src/plugins/graphicssystems/blittable/qblittable_image.h +++ /dev/null @@ -1,48 +0,0 @@ -#include <qimage.h> - -#include <private/qblittable_p.h> - - -class QImageBlittable : public QBlittable -{ -public: - QImageBlittable(QImage *image, bool deleteImage) - : QBlittable(image->size(), QBlittable::Capabilities(QBlittable::SolidRectCapability - |QBlittable::SourcePixmapCapability - |QBlittable::SourceOverPixmapCapability - |QBlittable::SourceOverScaledPixmapCapability)), - m_image(image), m_deleteImage(deleteImage) - { - - } - - ~QImageBlittable() { - if (m_deleteImage) - delete m_image; - } - - void fillRect(const QRectF &rect, const QColor &color) - { - QPainter p(lock()); - p.fillRect(rect,color); - } - void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &source) - { - //here it is possible to do a pixmap.pixmapData()->buffer() - //but is like this to show how to get the the blitter - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->width() && data->height()); - Q_ASSERT(data->classId() == QPixmapData::BlitterClass); - QBlittablePixmapData *blittableData = static_cast<QBlittablePixmapData*>(data); - - QPainter p(lock()); - p.drawImage(rect, *blittableData->blittable()->lock(),source); - } - -protected: - QImage *doLock() { return m_image; } - void doUnlock() { } -private: - QImage *m_image; - bool m_deleteImage; -}; diff --git a/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h b/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h deleted file mode 100644 index d45907f..0000000 --- a/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h +++ /dev/null @@ -1,53 +0,0 @@ -#include <private/qgraphicssystem_p.h> -#include <private/qblittable_p.h> -#include <private/qpixmap_blitter_p.h> -#include <private/qpixmap_raster_p.h> -#include <private/qwindowsurface_rasterblittable_p.h> - -#include "qblittable_image.h" - -class QImageBlittableWindowSurface : public QRasterBlittableWindowSurface -{ -public: - QImageBlittableWindowSurface(QWidget *widget) - : QRasterBlittableWindowSurface(widget) - {} - - QBlittable *createBlittable(QImage *rasterSurface) - { - return new QImageBlittable(rasterSurface,false); - } - -}; - -class QBlittableGraphicsSystem : public QGraphicsSystem -{ -public: - ~QBlittableGraphicsSystem() { } - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const - { - if (type == QPixmapData::PixmapType) - return new QBlittablePixmapData(type); - else - return new QRasterPixmapData(type); - } - - QWindowSurface *createWindowSurface(QWidget *widget) const - { - return new QImageBlittableWindowSurface(widget); - } - - QBlittable *createBlittable(const QSize &size) const - { - QImage *image = new QImage(size, QImage::Format_ARGB32_Premultiplied); - return new QImageBlittable(image,true); - } - - QList<QGraphicsSystemScreen *> screens() - { return m_screens; } - - QList<QGraphicsSystemScreen *> m_screens; -}; - - diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h index 85a303a..2a39912 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.h +++ b/src/plugins/platforms/directfb/qdirectfbblitter.h @@ -26,4 +26,10 @@ protected: friend class QDirectFbConvenience; }; +class QDirectFbBlitterPixmapData : public QBlittablePixmapData +{ +public: + QBlittable *createBlittable(const QSize &size) const { return new QDirectFbBlitter(size); } +}; + #endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index c47fc8d..b19a1d9 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -118,7 +118,7 @@ QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) if (type == QPixmapData::BitmapType) return new QRasterPixmapData(type); else - return new QBlittablePixmapData(type); + return new QDirectFbBlitterPixmapData; } QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp index 4ca9a72..271d061 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp @@ -63,7 +63,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId) dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); //WRONGSIZE QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); - m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); + m_pmdata = new QDirectFbBlitterPixmapData; m_pmdata->setBlittable(blitter); m_pixmap = new QPixmap(m_pmdata); } |