From 6ce6b8a378b0d97ba950240ffb048a4b7e485235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 20 Jun 2011 13:29:26 +0200 Subject: Rename QWindowSurface -> QBackingStore and split into platform / public. Also get rid of GL window surface and related classes. --- src/plugins/platforms/minimal/minimal.pro | 4 +- .../platforms/minimal/qminimalbackingstore.cpp | 85 +++++++++++++++++++++ .../platforms/minimal/qminimalbackingstore.h | 67 +++++++++++++++++ .../platforms/minimal/qminimalintegration.cpp | 7 +- .../platforms/minimal/qminimalintegration.h | 2 +- .../platforms/minimal/qminimalwindowsurface.cpp | 86 ---------------------- .../platforms/minimal/qminimalwindowsurface.h | 68 ----------------- 7 files changed, 158 insertions(+), 161 deletions(-) create mode 100644 src/plugins/platforms/minimal/qminimalbackingstore.cpp create mode 100644 src/plugins/platforms/minimal/qminimalbackingstore.h delete mode 100644 src/plugins/platforms/minimal/qminimalwindowsurface.cpp delete mode 100644 src/plugins/platforms/minimal/qminimalwindowsurface.h (limited to 'src/plugins/platforms/minimal') diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index d51b6b2ed0..53ae1b1319 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -6,9 +6,9 @@ DESTDIR = $$QT.gui.plugins/platforms SOURCES = main.cpp \ qminimalintegration.cpp \ - qminimalwindowsurface.cpp + qminimalbackingstore.cpp HEADERS = qminimalintegration.h \ - qminimalwindowsurface.h + qminimalbackingstore.h target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.cpp b/src/plugins/platforms/minimal/qminimalbackingstore.cpp new file mode 100644 index 0000000000..bd4f04dfcd --- /dev/null +++ b/src/plugins/platforms/minimal/qminimalbackingstore.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** 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 plugins 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 "qminimalbackingstore.h" +#include +#include + +QT_BEGIN_NAMESPACE + +QMinimalBackingStore::QMinimalBackingStore(QWindow *window) + : QPlatformBackingStore(window) +{ + //qDebug() << "QMinimalBackingStore::QMinimalBackingStore:" << (long)this; +} + +QMinimalBackingStore::~QMinimalBackingStore() +{ +} + +QPaintDevice *QMinimalBackingStore::paintDevice() +{ + //qDebug() << "QMinimalBackingStore::paintDevice"; + return &mImage; +} + +void QMinimalBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(window); + Q_UNUSED(region); + Q_UNUSED(offset); + + static int c = 0; + QString filename = QString("output%1.png").arg(c++, 4, 10, QLatin1Char('0')); + qDebug() << "QMinimalBackingStore::flush() saving contents to" << filename.toLocal8Bit().constData(); + mImage.save(filename); +} + +void QMinimalBackingStore::resize(const QSize &size, const QRegion &) +{ + //qDebug() << "QMinimalBackingStore::setGeometry:" << (long)this << rect; + QImage::Format format = QGuiApplicationPrivate::platformIntegration()->screens().first()->format(); + if (mImage.size() != size) + mImage = QImage(size, format); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.h b/src/plugins/platforms/minimal/qminimalbackingstore.h new file mode 100644 index 0000000000..9b61275e9d --- /dev/null +++ b/src/plugins/platforms/minimal/qminimalbackingstore.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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 plugins 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 QBACKINGSTORE_MINIMAL_H +#define QBACKINGSTORE_MINIMAL_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QMinimalBackingStore : public QPlatformBackingStore +{ +public: + QMinimalBackingStore(QWindow *window); + ~QMinimalBackingStore(); + + QPaintDevice *paintDevice(); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size, const QRegion &staticContents); + +private: + QImage mImage; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index 23bade99b6..c3300ce3b8 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qminimalintegration.h" -#include "qminimalwindowsurface.h" +#include "qminimalbackingstore.h" #include #include @@ -75,8 +75,7 @@ QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) cons return new QPlatformWindow(window); } -QWindowSurface *QMinimalIntegration::createWindowSurface(QWindow *window, WId winId) const +QPlatformBackingStore *QMinimalIntegration::createPlatformBackingStore(QWindow *window) const { - Q_UNUSED(winId); - return new QMinimalWindowSurface(window); + return new QMinimalBackingStore(window); } diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index 6ac45c2385..efb0f352d4 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -73,7 +73,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWindow *window) const; - QWindowSurface *createWindowSurface(QWindow *window, WId winId) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.cpp b/src/plugins/platforms/minimal/qminimalwindowsurface.cpp deleted file mode 100644 index f28b34a000..0000000000 --- a/src/plugins/platforms/minimal/qminimalwindowsurface.cpp +++ /dev/null @@ -1,86 +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 plugins 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 "qminimalwindowsurface.h" -#include -#include - -QT_BEGIN_NAMESPACE - -QMinimalWindowSurface::QMinimalWindowSurface(QWindow *window) - : QWindowSurface(window) -{ - //qDebug() << "QMinimalWindowSurface::QMinimalWindowSurface:" << (long)this; -} - -QMinimalWindowSurface::~QMinimalWindowSurface() -{ -} - -QPaintDevice *QMinimalWindowSurface::paintDevice() -{ - //qDebug() << "QMinimalWindowSurface::paintDevice"; - return &mImage; -} - -void QMinimalWindowSurface::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(window); - Q_UNUSED(region); - Q_UNUSED(offset); - - static int c = 0; - QString filename = QString("output%1.png").arg(c++, 4, 10, QLatin1Char('0')); - qDebug() << "QMinimalWindowSurface::flush() saving contents to" << filename.toLocal8Bit().constData(); - mImage.save(filename); -} - -void QMinimalWindowSurface::resize(const QSize &size) -{ - //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect; - QWindowSurface::resize(size); - QImage::Format format = QGuiApplicationPrivate::platformIntegration()->screens().first()->format(); - if (mImage.size() != size) - mImage = QImage(size, format); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.h b/src/plugins/platforms/minimal/qminimalwindowsurface.h deleted file mode 100644 index 943cdc43e1..0000000000 --- a/src/plugins/platforms/minimal/qminimalwindowsurface.h +++ /dev/null @@ -1,68 +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 plugins 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 QWINDOWSURFACE_MINIMAL_H -#define QWINDOWSURFACE_MINIMAL_H - -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -class QMinimalWindowSurface : public QWindowSurface -{ -public: - QMinimalWindowSurface(QWindow *window); - ~QMinimalWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size); - -private: - QImage mImage; -}; - -QT_END_NAMESPACE - -#endif -- cgit v1.2.3