mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
kill the runtime graphics system with fire
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e4ed5d7cef
commit
6e0f5e5e06
11 changed files with 6 additions and 648 deletions
|
@ -71,10 +71,6 @@
|
|||
#include "qmessagebox.h"
|
||||
#include <QtGui/qgraphicsproxywidget.h>
|
||||
|
||||
#ifdef QT_GRAPHICSSYSTEM_RUNTIME
|
||||
#include "qgraphicssystem_runtime_p.h"
|
||||
#endif
|
||||
|
||||
#include "qinputcontext.h"
|
||||
#include "qkeymapper_p.h"
|
||||
|
||||
|
@ -420,7 +416,6 @@ QPalette *QApplicationPrivate::set_pal = 0; // default palette set by pro
|
|||
|
||||
QGraphicsSystem *QApplicationPrivate::graphics_system = 0; // default graphics system
|
||||
QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization
|
||||
bool QApplicationPrivate::runtime_graphics_system = false;
|
||||
|
||||
Q_GLOBAL_STATIC(QMutex, applicationFontMutex)
|
||||
QFont *QApplicationPrivate::app_font = 0; // default application font
|
||||
|
@ -1526,14 +1521,7 @@ QStyle* QApplication::setStyle(const QString& style)
|
|||
|
||||
void QApplication::setGraphicsSystem(const QString &system)
|
||||
{
|
||||
#ifdef QT_GRAPHICSSYSTEM_RUNTIME
|
||||
if (QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) {
|
||||
QRuntimeGraphicsSystem *r =
|
||||
static_cast<QRuntimeGraphicsSystem *>(QApplicationPrivate::graphics_system);
|
||||
r->setGraphicsSystem(system);
|
||||
} else
|
||||
#endif
|
||||
QApplicationPrivate::graphics_system_name = system;
|
||||
QApplicationPrivate::graphics_system_name = system;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -365,7 +365,6 @@ public:
|
|||
static QPalette *set_pal;
|
||||
static QGraphicsSystem *graphics_system;
|
||||
static QString graphics_system_name;
|
||||
static bool runtime_graphics_system;
|
||||
|
||||
private:
|
||||
static QFont *app_font; // private for a reason! Always use QApplication::font() instead!
|
||||
|
|
|
@ -56,7 +56,6 @@ set(GUI_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qpen_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qfixed_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystem_raster_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystem_runtime_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystemfactory_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystemplugin_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qwindowsurface_raster_p.h
|
||||
|
@ -115,7 +114,6 @@ set(GUI_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgrayraster.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qbackingstore.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystem_raster.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystem_runtime.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystemfactory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qgraphicssystemplugin.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/painting/qwindowsurface_raster.cpp
|
||||
|
|
|
@ -1,417 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** 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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <qgraphicssystem_runtime_p.h>
|
||||
#include <qgraphicssystem_raster_p.h>
|
||||
#include <qgraphicssystemfactory_p.h>
|
||||
#include <qapplication_p.h>
|
||||
#include <qwidget_p.h>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QBitmap>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static int qt_pixmap_serial = 0;
|
||||
|
||||
#define READBACK(f) \
|
||||
f \
|
||||
readBackInfo();
|
||||
|
||||
|
||||
class QDeferredGraphicsSystemChange : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QDeferredGraphicsSystemChange(QRuntimeGraphicsSystem *gs, const QString& graphicsSystemName)
|
||||
: m_graphicsSystem(gs), m_graphicsSystemName(graphicsSystemName)
|
||||
{
|
||||
}
|
||||
|
||||
void launch()
|
||||
{
|
||||
QTimer::singleShot(0, this, SLOT(doChange()));
|
||||
}
|
||||
|
||||
private slots:
|
||||
|
||||
void doChange()
|
||||
{
|
||||
m_graphicsSystem->setGraphicsSystem(m_graphicsSystemName);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
QRuntimeGraphicsSystem *m_graphicsSystem;
|
||||
QString m_graphicsSystemName;
|
||||
};
|
||||
|
||||
QRuntimePixmapData::QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type)
|
||||
: QPixmapData(type, RuntimeClass), m_graphicsSystem(gs)
|
||||
{
|
||||
setSerialNumber(++qt_pixmap_serial);
|
||||
}
|
||||
|
||||
QRuntimePixmapData::~QRuntimePixmapData()
|
||||
{
|
||||
if (QApplicationPrivate::graphics_system)
|
||||
m_graphicsSystem->removePixmapData(this);
|
||||
delete m_data;
|
||||
}
|
||||
|
||||
void QRuntimePixmapData::readBackInfo()
|
||||
{
|
||||
w = m_data->width();
|
||||
h = m_data->height();
|
||||
d = m_data->depth();
|
||||
is_null = m_data->isNull();
|
||||
}
|
||||
|
||||
|
||||
QPixmapData *QRuntimePixmapData::createCompatiblePixmapData() const
|
||||
{
|
||||
QRuntimePixmapData *rtData = new QRuntimePixmapData(m_graphicsSystem, pixelType());
|
||||
rtData->m_data = m_data->createCompatiblePixmapData();
|
||||
return rtData;
|
||||
}
|
||||
|
||||
|
||||
void QRuntimePixmapData::resize(int width, int height)
|
||||
{
|
||||
READBACK(
|
||||
m_data->resize(width, height);
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
void QRuntimePixmapData::fromImage(const QImage &image,
|
||||
Qt::ImageConversionFlags flags)
|
||||
{
|
||||
READBACK(
|
||||
m_data->fromImage(image, flags);
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
bool QRuntimePixmapData::fromFile(const QString &filename, const char *format,
|
||||
Qt::ImageConversionFlags flags)
|
||||
{
|
||||
bool success(false);
|
||||
READBACK(
|
||||
success = m_data->fromFile(filename, format, flags);
|
||||
)
|
||||
return success;
|
||||
}
|
||||
|
||||
bool QRuntimePixmapData::fromData(const uchar *buffer, uint len, const char *format,
|
||||
Qt::ImageConversionFlags flags)
|
||||
{
|
||||
bool success(false);
|
||||
READBACK(
|
||||
success = m_data->fromData(buffer, len, format, flags);
|
||||
)
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
void QRuntimePixmapData::copy(const QPixmapData *data, const QRect &rect)
|
||||
{
|
||||
if (data->runtimeData()) {
|
||||
READBACK(
|
||||
m_data->copy(data->runtimeData(), rect);
|
||||
)
|
||||
} else {
|
||||
READBACK(
|
||||
m_data->copy(data, rect);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
bool QRuntimePixmapData::scroll(int dx, int dy, const QRect &rect)
|
||||
{
|
||||
return m_data->scroll(dx, dy, rect);
|
||||
}
|
||||
|
||||
|
||||
int QRuntimePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
|
||||
{
|
||||
return m_data->metric(metric);
|
||||
}
|
||||
|
||||
void QRuntimePixmapData::fill(const QColor &color)
|
||||
{
|
||||
return m_data->fill(color);
|
||||
}
|
||||
|
||||
QBitmap QRuntimePixmapData::mask() const
|
||||
{
|
||||
return m_data->mask();
|
||||
}
|
||||
|
||||
void QRuntimePixmapData::setMask(const QBitmap &mask)
|
||||
{
|
||||
READBACK(
|
||||
m_data->setMask(mask);
|
||||
)
|
||||
}
|
||||
|
||||
bool QRuntimePixmapData::hasAlphaChannel() const
|
||||
{
|
||||
return m_data->hasAlphaChannel();
|
||||
}
|
||||
|
||||
QPixmap QRuntimePixmapData::transformed(const QTransform &matrix,
|
||||
Qt::TransformationMode mode) const
|
||||
{
|
||||
return m_data->transformed(matrix, mode);
|
||||
}
|
||||
|
||||
void QRuntimePixmapData::setAlphaChannel(const QPixmap &alphaChannel)
|
||||
{
|
||||
READBACK(
|
||||
m_data->setAlphaChannel(alphaChannel);
|
||||
)
|
||||
}
|
||||
|
||||
QPixmap QRuntimePixmapData::alphaChannel() const
|
||||
{
|
||||
return m_data->alphaChannel();
|
||||
}
|
||||
|
||||
QImage QRuntimePixmapData::toImage() const
|
||||
{
|
||||
return m_data->toImage();
|
||||
}
|
||||
|
||||
QPaintEngine* QRuntimePixmapData::paintEngine() const
|
||||
{
|
||||
return m_data->paintEngine();
|
||||
}
|
||||
|
||||
QImage* QRuntimePixmapData::buffer()
|
||||
{
|
||||
return m_data->buffer();
|
||||
}
|
||||
|
||||
|
||||
QPixmapData* QRuntimePixmapData::runtimeData() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window)
|
||||
: QWindowSurface(window), m_graphicsSystem(gs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QRuntimeWindowSurface::~QRuntimeWindowSurface()
|
||||
{
|
||||
if (QApplicationPrivate::graphics_system)
|
||||
m_graphicsSystem->removeWindowSurface(this);
|
||||
}
|
||||
|
||||
QPaintDevice *QRuntimeWindowSurface::paintDevice()
|
||||
{
|
||||
return m_windowSurface->paintDevice();
|
||||
}
|
||||
|
||||
void QRuntimeWindowSurface::flush(QWidget *widget, const QRegion ®ion,
|
||||
const QPoint &offset)
|
||||
{
|
||||
m_windowSurface->flush(widget, region, offset);
|
||||
|
||||
int destroyPolicy = m_graphicsSystem->windowSurfaceDestroyPolicy();
|
||||
if(m_pendingWindowSurface &&
|
||||
destroyPolicy == QRuntimeGraphicsSystem::DestroyAfterFirstFlush) {
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "QRuntimeWindowSurface::flush() - destroy pending window surface";
|
||||
#endif
|
||||
m_pendingWindowSurface.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void QRuntimeWindowSurface::setGeometry(const QRect &rect)
|
||||
{
|
||||
QWindowSurface::setGeometry(rect);
|
||||
m_windowSurface->setGeometry(rect);
|
||||
}
|
||||
|
||||
bool QRuntimeWindowSurface::scroll(const QRegion &area, int dx, int dy)
|
||||
{
|
||||
return m_windowSurface->scroll(area, dx, dy);
|
||||
}
|
||||
|
||||
void QRuntimeWindowSurface::beginPaint(const QRegion &rgn)
|
||||
{
|
||||
m_windowSurface->beginPaint(rgn);
|
||||
}
|
||||
|
||||
void QRuntimeWindowSurface::endPaint(const QRegion &rgn)
|
||||
{
|
||||
m_windowSurface->endPaint(rgn);
|
||||
}
|
||||
|
||||
QImage* QRuntimeWindowSurface::buffer(const QWidget *widget)
|
||||
{
|
||||
return m_windowSurface->buffer(widget);
|
||||
}
|
||||
|
||||
QPixmap QRuntimeWindowSurface::grabWidget(const QWidget *widget, const QRect& rectangle) const
|
||||
{
|
||||
return m_windowSurface->grabWidget(widget, rectangle);
|
||||
}
|
||||
|
||||
QPoint QRuntimeWindowSurface::offset(const QWidget *widget) const
|
||||
{
|
||||
return m_windowSurface->offset(widget);
|
||||
}
|
||||
|
||||
QWindowSurface::WindowSurfaceFeatures QRuntimeWindowSurface::features() const
|
||||
{
|
||||
return m_windowSurface->features();
|
||||
}
|
||||
|
||||
QRuntimeGraphicsSystem::QRuntimeGraphicsSystem()
|
||||
: m_windowSurfaceDestroyPolicy(DestroyImmediately),
|
||||
m_graphicsSystem(0)
|
||||
{
|
||||
QApplicationPrivate::runtime_graphics_system = true;
|
||||
|
||||
if (!qgetenv("QT_DEFAULT_RUNTIME_SYSTEM").isEmpty()) {
|
||||
m_graphicsSystemName = QString::fromLocal8Bit(qgetenv("QT_DEFAULT_RUNTIME_SYSTEM"));
|
||||
} else {
|
||||
#ifdef QT_DEFAULT_RUNTIME_SYSTEM
|
||||
m_graphicsSystemName = QLatin1String(QT_DEFAULT_RUNTIME_SYSTEM);
|
||||
if (m_graphicsSystemName.isNull())
|
||||
#endif
|
||||
m_graphicsSystemName = QLatin1String("raster");
|
||||
}
|
||||
|
||||
|
||||
m_graphicsSystem = QGraphicsSystemFactory::create(m_graphicsSystemName);
|
||||
|
||||
QApplicationPrivate::graphics_system_name = QLatin1String("runtime");
|
||||
}
|
||||
|
||||
|
||||
QPixmapData *QRuntimeGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
|
||||
{
|
||||
Q_ASSERT(m_graphicsSystem);
|
||||
QPixmapData *data = m_graphicsSystem->createPixmapData(type);
|
||||
|
||||
QRuntimePixmapData *rtData = new QRuntimePixmapData(this, type);
|
||||
rtData->m_data = data;
|
||||
m_pixmapDatas << rtData;
|
||||
|
||||
return rtData;
|
||||
}
|
||||
|
||||
QWindowSurface *QRuntimeGraphicsSystem::createWindowSurface(QWidget *widget) const
|
||||
{
|
||||
Q_ASSERT(m_graphicsSystem);
|
||||
QRuntimeWindowSurface *rtSurface = new QRuntimeWindowSurface(this, widget);
|
||||
rtSurface->m_windowSurface.reset(m_graphicsSystem->createWindowSurface(widget));
|
||||
widget->setWindowSurface(rtSurface);
|
||||
m_windowSurfaces << rtSurface;
|
||||
return rtSurface;
|
||||
}
|
||||
|
||||
void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name)
|
||||
{
|
||||
if (m_graphicsSystemName == name)
|
||||
return;
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "QRuntimeGraphicsSystem::setGraphicsSystem( " << name << " )";
|
||||
#endif
|
||||
QGraphicsSystem *oldSystem = m_graphicsSystem;
|
||||
m_graphicsSystem = QGraphicsSystemFactory::create(name);
|
||||
m_graphicsSystemName = name;
|
||||
|
||||
Q_ASSERT(m_graphicsSystem);
|
||||
|
||||
m_pendingGraphicsSystemName = QString();
|
||||
|
||||
for (int i = 0; i < m_pixmapDatas.size(); ++i) {
|
||||
QRuntimePixmapData *proxy = m_pixmapDatas.at(i);
|
||||
QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data);
|
||||
newData->fromImage(proxy->m_data->toImage(), Qt::NoOpaqueDetection);
|
||||
delete proxy->m_data;
|
||||
proxy->m_data = newData;
|
||||
proxy->readBackInfo();
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_windowSurfaces.size(); ++i) {
|
||||
QRuntimeWindowSurface *proxy = m_windowSurfaces.at(i);
|
||||
QWidget *widget = proxy->m_windowSurface->window();
|
||||
|
||||
if(m_windowSurfaceDestroyPolicy == DestroyAfterFirstFlush)
|
||||
proxy->m_pendingWindowSurface.reset(proxy->m_windowSurface.take());
|
||||
|
||||
QWindowSurface *newWindowSurface = m_graphicsSystem->createWindowSurface(widget);
|
||||
newWindowSurface->setGeometry(proxy->geometry());
|
||||
|
||||
proxy->m_windowSurface.reset(newWindowSurface);
|
||||
qt_widget_private(widget)->invalidateBuffer(widget->rect());
|
||||
}
|
||||
|
||||
delete oldSystem;
|
||||
}
|
||||
|
||||
void QRuntimeGraphicsSystem::removePixmapData(QRuntimePixmapData *pixmapData) const
|
||||
{
|
||||
int index = m_pixmapDatas.lastIndexOf(pixmapData);
|
||||
m_pixmapDatas.removeAt(index);
|
||||
}
|
||||
|
||||
void QRuntimeGraphicsSystem::removeWindowSurface(QRuntimeWindowSurface *windowSurface) const
|
||||
{
|
||||
int index = m_windowSurfaces.lastIndexOf(windowSurface);
|
||||
m_windowSurfaces.removeAt(index);
|
||||
}
|
||||
|
||||
#include "moc_qgraphicssystem_runtime.cpp"
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** 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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QGRAPHICSSYSTEM_RUNTIME_P_H
|
||||
#define QGRAPHICSSYSTEM_RUNTIME_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists for the convenience
|
||||
// of other Qt classes. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "qgraphicssystem_p.h"
|
||||
|
||||
#include <qpixmapdata_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QRuntimeGraphicsSystem;
|
||||
|
||||
class Q_GUI_EXPORT QRuntimePixmapData : public QPixmapData {
|
||||
public:
|
||||
QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type);
|
||||
~QRuntimePixmapData();
|
||||
|
||||
virtual QPixmapData *createCompatiblePixmapData() const;
|
||||
virtual void resize(int width, int height);
|
||||
virtual void fromImage(const QImage &image,
|
||||
Qt::ImageConversionFlags flags);
|
||||
|
||||
virtual bool fromFile(const QString &filename, const char *format,
|
||||
Qt::ImageConversionFlags flags);
|
||||
virtual bool fromData(const uchar *buffer, uint len, const char *format,
|
||||
Qt::ImageConversionFlags flags);
|
||||
|
||||
virtual void copy(const QPixmapData *data, const QRect &rect);
|
||||
virtual bool scroll(int dx, int dy, const QRect &rect);
|
||||
|
||||
virtual int metric(QPaintDevice::PaintDeviceMetric metric) const;
|
||||
virtual void fill(const QColor &color);
|
||||
virtual QBitmap mask() const;
|
||||
virtual void setMask(const QBitmap &mask);
|
||||
virtual bool hasAlphaChannel() const;
|
||||
virtual QPixmap transformed(const QTransform &matrix,
|
||||
Qt::TransformationMode mode) const;
|
||||
virtual void setAlphaChannel(const QPixmap &alphaChannel);
|
||||
virtual QPixmap alphaChannel() const;
|
||||
virtual QImage toImage() const;
|
||||
virtual QPaintEngine *paintEngine() const;
|
||||
|
||||
virtual QImage *buffer();
|
||||
|
||||
void readBackInfo();
|
||||
|
||||
QPixmapData *m_data;
|
||||
|
||||
|
||||
virtual QPixmapData *runtimeData() const;
|
||||
|
||||
private:
|
||||
const QRuntimeGraphicsSystem *m_graphicsSystem;
|
||||
|
||||
};
|
||||
|
||||
class QRuntimeWindowSurface : public QWindowSurface {
|
||||
public:
|
||||
QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window);
|
||||
~QRuntimeWindowSurface();
|
||||
|
||||
virtual QPaintDevice *paintDevice();
|
||||
virtual void flush(QWidget *widget, const QRegion ®ion,
|
||||
const QPoint &offset);
|
||||
virtual void setGeometry(const QRect &rect);
|
||||
|
||||
virtual bool scroll(const QRegion &area, int dx, int dy);
|
||||
|
||||
virtual void beginPaint(const QRegion &);
|
||||
virtual void endPaint(const QRegion &);
|
||||
|
||||
virtual QImage* buffer(const QWidget *widget);
|
||||
virtual QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const;
|
||||
|
||||
virtual QPoint offset(const QWidget *widget) const;
|
||||
|
||||
virtual WindowSurfaceFeatures features() const;
|
||||
|
||||
QScopedPointer<QWindowSurface> m_windowSurface;
|
||||
QScopedPointer<QWindowSurface> m_pendingWindowSurface;
|
||||
|
||||
private:
|
||||
const QRuntimeGraphicsSystem *m_graphicsSystem;
|
||||
};
|
||||
|
||||
class QRuntimeGraphicsSystem : public QGraphicsSystem
|
||||
{
|
||||
public:
|
||||
|
||||
enum WindowSurfaceDestroyPolicy
|
||||
{
|
||||
DestroyImmediately,
|
||||
DestroyAfterFirstFlush
|
||||
};
|
||||
|
||||
public:
|
||||
QRuntimeGraphicsSystem();
|
||||
|
||||
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
|
||||
QWindowSurface *createWindowSurface(QWidget *widget) const;
|
||||
|
||||
void removePixmapData(QRuntimePixmapData *pixmapData) const;
|
||||
void removeWindowSurface(QRuntimeWindowSurface *windowSurface) const;
|
||||
|
||||
void setGraphicsSystem(const QString &name);
|
||||
QString graphicsSystemName() const { return m_graphicsSystemName; }
|
||||
|
||||
void setWindowSurfaceDestroyPolicy(WindowSurfaceDestroyPolicy policy)
|
||||
{
|
||||
m_windowSurfaceDestroyPolicy = policy;
|
||||
}
|
||||
|
||||
int windowSurfaceDestroyPolicy() const { return m_windowSurfaceDestroyPolicy; }
|
||||
|
||||
|
||||
private:
|
||||
int m_windowSurfaceDestroyPolicy;
|
||||
QGraphicsSystem *m_graphicsSystem;
|
||||
mutable QList<QRuntimePixmapData *> m_pixmapDatas;
|
||||
mutable QList<QRuntimeWindowSurface *> m_windowSurfaces;
|
||||
QString m_graphicsSystemName;
|
||||
|
||||
QString m_pendingGraphicsSystemName;
|
||||
|
||||
friend class QRuntimePixmapData;
|
||||
friend class QRuntimeWindowSurface;
|
||||
friend class QMeeGoGraphicsSystem;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
|
@ -46,7 +46,6 @@
|
|||
|
||||
#include "qapplication.h"
|
||||
#include "qgraphicssystem_raster_p.h"
|
||||
#include "qgraphicssystem_runtime_p.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -65,10 +64,6 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key)
|
|||
if (system.isEmpty()) {
|
||||
system = QLatin1String("opengl");
|
||||
}
|
||||
#elif defined (QT_GRAPHICSSYSTEM_RUNTIME)
|
||||
if (system.isEmpty()) {
|
||||
system = QLatin1String("runtime");
|
||||
}
|
||||
#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) || defined(Q_WS_X11)
|
||||
if (system.isEmpty()) {
|
||||
system = QLatin1String("raster");
|
||||
|
@ -77,8 +72,6 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key)
|
|||
|
||||
if (system == QLatin1String("raster"))
|
||||
return new QRasterGraphicsSystem;
|
||||
else if (system == QLatin1String("runtime"))
|
||||
return new QRuntimeGraphicsSystem;
|
||||
else if (system.isEmpty() || system == QLatin1String("native"))
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -113,10 +113,8 @@ public:
|
|||
QWindowSurface::QWindowSurface(QWidget *window, bool setDefaultSurface)
|
||||
: d_ptr(new QWindowSurfacePrivate(window))
|
||||
{
|
||||
if (!QApplicationPrivate::runtime_graphics_system) {
|
||||
if(setDefaultSurface && window)
|
||||
window->setWindowSurface(this);
|
||||
}
|
||||
if(setDefaultSurface && window)
|
||||
window->setWindowSurface(this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include <qgl_p.h>
|
||||
#include <qimagepixmapcleanuphooks_p.h>
|
||||
#include <qapplication_p.h>
|
||||
#include <qgraphicssystem_runtime_p.h>
|
||||
#include <qimage_p.h>
|
||||
#include <qeglproperties_p.h>
|
||||
#include <qeglcontext_p.h>
|
||||
|
@ -236,20 +235,6 @@ QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData *origin)
|
|||
return new QRasterPixmapData(origin->pixelType());
|
||||
}
|
||||
|
||||
QPixmapData* QMeeGoGraphicsSystem::wrapPixmapData(QPixmapData *pmd)
|
||||
{
|
||||
QString name = QApplicationPrivate::instance()->graphics_system_name;
|
||||
if (name == "runtime") {
|
||||
QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system;
|
||||
QRuntimePixmapData *rt = new QRuntimePixmapData(rsystem, pmd->pixelType());;
|
||||
rt->m_data = pmd;
|
||||
rt->readBackInfo();
|
||||
rsystem->m_pixmapDatas << rt;
|
||||
return rt;
|
||||
} else
|
||||
return pmd;
|
||||
}
|
||||
|
||||
void QMeeGoGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/)
|
||||
{
|
||||
if (QMeeGoGraphicsSystem::surfaceWasCreated) {
|
||||
|
@ -294,7 +279,7 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handl
|
|||
if (QMeeGoGraphicsSystem::meeGoRunning()) {
|
||||
QMeeGoPixmapData *pmd = new QMeeGoPixmapData;
|
||||
pmd->fromEGLSharedImage(handle, softImage);
|
||||
return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
|
||||
return pmd;
|
||||
} else {
|
||||
QRasterPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType);
|
||||
pmd->fromImage(softImage, Qt::NoFormatConversion);
|
||||
|
@ -305,7 +290,7 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handl
|
|||
qFatal("Iternal misalignment of raster data detected. Prolly a QImage copy fail.");
|
||||
|
||||
QMeeGoPixmapData::registerSharedImage(handle, softImage);
|
||||
return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
|
||||
return pmd;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,7 +309,7 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataWithGLTexture(int w, int h)
|
|||
{
|
||||
QGLPixmapData *pmd = new QGLPixmapData(QPixmapData::PixmapType);
|
||||
pmd->resize(w, h);
|
||||
return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
|
||||
return pmd;
|
||||
}
|
||||
|
||||
bool QMeeGoGraphicsSystem::meeGoRunning()
|
||||
|
|
|
@ -61,7 +61,6 @@ public:
|
|||
virtual QPixmapData *createPixmapData(QPixmapData::PixelType) const;
|
||||
virtual QPixmapData *createPixmapData(QPixmapData *origin);
|
||||
|
||||
static QPixmapData *wrapPixmapData(QPixmapData *pmd);
|
||||
static void setSurfaceFixedSize(int width, int height);
|
||||
static void setSurfaceScaling(int x, int y, int width, int height);
|
||||
static void setTranslucent(bool translucent);
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include <qwindowsurface_gl_p.h>
|
||||
#include <qeglcontext_p.h>
|
||||
#include <qapplication_p.h>
|
||||
#include <qgraphicssystem_runtime_p.h>
|
||||
#include <qpixmap_x11_p.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include <qwindowsurface_gl_p.h>
|
||||
#include <qeglcontext_p.h>
|
||||
#include <qapplication_p.h>
|
||||
#include <qgraphicssystem_runtime_p.h>
|
||||
|
||||
// from dithering.cpp
|
||||
extern unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride);
|
||||
|
|
Loading…
Add table
Reference in a new issue