From 36547f4eff44361f7a6acd0cff107c0e47561f93 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 27 Apr 2012 01:33:35 +0200 Subject: Expose QPA API under qpa/* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main reasons for doing this are: 1. _qpa.h end up in the master QtGui include file. QtGui is meant for userland applications. qpa code is neither binary nor source compatible. Inadvertant use of QPA api makes the user code binary-incompatible. 2. syncqt creates forwarding headers for non-private header files. This gives people the impression that this is public API. As discussed on the mailing list, even though QPA api is internal and subject to change, it needs to treated differently from private headers since they will be used by in-qtbase and out-of-qtbase plugins. This commit does the following: 1. The _qpa in QPA header files is dropped. 2. syncqt now treats any file with qplatform prefix as a special file and moves it to qpa/ directory. The recommended way of using QPA API in plugins is: #include . This allows the user include QPA API from multiple modules (for example, qplatformfoo might be in QtPrintSupport) 3. The user needs to explicitly add QT += -private to get access to the qpa api. 4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo includes. This commit does not change the cpp filenames. This requires a more careful merging of existing non qpa cpp files and existing cpp files on a case by case basis. This can be done at anytime. The following files are not renamed as part of this changed but will be fixed as part of a future change: src/gui/kernel/qgenericpluginfactory_qpa.h src/gui/kernel/qgenericplugin_qpa.h src/gui/kernel/qwindowsysteminterface_qpa.h files were renamed using for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done includes were renamed using script for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include ,g' \ -e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include ,g' \ -e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include ,g' \ -e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include ,g' \ -e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include ,g' \ -e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include ,g' \ $file done Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67 Reviewed-by: Morten Johan Sørvig Reviewed-by: Samuel Rødal Reviewed-by: Friedemann Kleint Reviewed-by: Sean Harmer Reviewed-by: Lars Knoll Reviewed-by: Gunnar Sletta --- src/gui/image/image.pri | 2 +- src/gui/image/qbitmap.cpp | 4 +- src/gui/image/qimage.cpp | 4 +- src/gui/image/qimagepixmapcleanuphooks.cpp | 2 +- src/gui/image/qnativeimage.cpp | 2 +- src/gui/image/qpixmap.cpp | 4 +- src/gui/image/qpixmap_blitter_p.h | 2 +- src/gui/image/qpixmap_raster_p.h | 2 +- src/gui/image/qpixmap_win.cpp | 2 +- src/gui/image/qplatformpixmap.cpp | 4 +- src/gui/image/qplatformpixmap.h | 162 +++++++++++++++++++++++++++++ src/gui/image/qplatformpixmap_qpa.h | 162 ----------------------------- 12 files changed, 176 insertions(+), 176 deletions(-) create mode 100644 src/gui/image/qplatformpixmap.h delete mode 100644 src/gui/image/qplatformpixmap_qpa.h (limited to 'src/gui/image') diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 34a33aa0f0..737b7fcbd4 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -21,7 +21,7 @@ HEADERS += \ image/qpixmap_blitter_p.h \ image/qpixmapcache.h \ image/qpixmapcache_p.h \ - image/qplatformpixmap_qpa.h \ + image/qplatformpixmap.h \ image/qimagepixmapcleanuphooks_p.h \ SOURCES += \ diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index f3c26dd5b2..499f9f48f2 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include "qbitmap.h" -#include "qplatformpixmap_qpa.h" -#include "qplatformintegration_qpa.h" +#include +#include #include "qimage.h" #include "qscreen.h" #include "qvariant.h" diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index b8ec7de851..91b21227df 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -50,13 +50,13 @@ #include "qstringlist.h" #include "qvariant.h" #include "qimagepixmapcleanuphooks_p.h" -#include "qplatformintegration_qpa.h" +#include #include #include #include #include #include -#include +#include #include #include #include diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index b118f5f856..548934829e 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qimagepixmapcleanuphooks_p.h" -#include "qplatformpixmap_qpa.h" +#include #include "private/qimage_p.h" diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 96d7a0487b..c562b0bd6d 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -41,7 +41,7 @@ #include #include "qnativeimage_p.h" -#include "qplatformscreen_qpa.h" +#include #include "private/qguiapplication_p.h" #include "qscreen.h" diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index cefb8edf74..248caf7f3d 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -42,7 +42,7 @@ #include #include "qpixmap.h" -#include "qplatformpixmap_qpa.h" +#include #include "qimagepixmapcleanuphooks_p.h" #include "qbitmap.h" @@ -63,7 +63,7 @@ #include "qthread.h" #include "qdebug.h" -# include "qplatformintegration_qpa.h" +#include #include "qpixmap_raster_p.h" #include "private/qhexstring_p.h" diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 95397374c6..174277f9eb 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -42,7 +42,7 @@ #ifndef QPIXMAP_BLITTER_P_H #define QPIXMAP_BLITTER_P_H -#include +#include #include #ifndef QT_NO_BLITTABLE diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index 864fad42ec..8e1a8ccc03 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 66a829f5de..c25393c72e 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qpixmap.h" -#include "qplatformpixmap_qpa.h" +#include #include "qpixmap_raster_p.h" #include diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp index 073c267fbe..769cf5f90b 100644 --- a/src/gui/image/qplatformpixmap.cpp +++ b/src/gui/image/qplatformpixmap.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qplatformpixmap_qpa.h" -#include "qplatformintegration_qpa.h" +#include "qplatformpixmap.h" +#include #include #include #include diff --git a/src/gui/image/qplatformpixmap.h b/src/gui/image/qplatformpixmap.h new file mode 100644 index 0000000000..154c5079a7 --- /dev/null +++ b/src/gui/image/qplatformpixmap.h @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPIXMAPDATA_P_H +#define QPIXMAPDATA_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + + +class QImageReader; + +class Q_GUI_EXPORT QPlatformPixmap +{ +public: + enum PixelType { + // WARNING: Do not change the first two + // Must match QPixmap::Type + PixmapType, BitmapType + }; + + enum ClassId { RasterClass, DirectFBClass, + BlitterClass, CustomClass = 1024 }; + + QPlatformPixmap(PixelType pixelType, int classId); + virtual ~QPlatformPixmap(); + + virtual QPlatformPixmap *createCompatiblePlatformPixmap() const; + + virtual void resize(int width, int height) = 0; + virtual void fromImage(const QImage &image, + Qt::ImageConversionFlags flags) = 0; + virtual void fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags); + + virtual bool fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags); + virtual bool fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags); + + virtual void copy(const QPlatformPixmap *data, const QRect &rect); + virtual bool scroll(int dx, int dy, const QRect &rect); + + virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0; + virtual void fill(const QColor &color) = 0; + + virtual bool hasAlphaChannel() const = 0; + virtual QPixmap transformed(const QTransform &matrix, + Qt::TransformationMode mode) const; + + virtual QImage toImage() const = 0; + virtual QImage toImage(const QRect &rect) const; + virtual QPaintEngine* paintEngine() const = 0; + + inline int serialNumber() const { return ser_no; } + + inline PixelType pixelType() const { return type; } + inline ClassId classId() const { return static_cast(id); } + + virtual QImage* buffer(); + + inline int width() const { return w; } + inline int height() const { return h; } + inline int colorCount() const { return metric(QPaintDevice::PdmNumColors); } + inline int depth() const { return d; } + inline bool isNull() const { return is_null; } + inline qint64 cacheKey() const { + int classKey = id; + if (classKey >= 1024) + classKey = -(classKey >> 10); + return ((((qint64) classKey) << 56) + | (((qint64) ser_no) << 32) + | ((qint64) detach_no)); + } + + static QPlatformPixmap *create(int w, int h, PixelType type); + +protected: + + void setSerialNumber(int serNo); + int w; + int h; + int d; + bool is_null; + +private: + friend class QPixmap; + friend class QImagePixmapCleanupHooks; // Needs to set is_cached + friend class QOpenGLTextureCache; //Needs to check the reference count + friend class QExplicitlySharedDataPointer; + + QAtomicInt ref; + int detach_no; + + PixelType type; + int id; + int ser_no; + uint is_cached; +}; + +# define QT_XFORM_TYPE_MSBFIRST 0 +# define QT_XFORM_TYPE_LSBFIRST 1 +extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPIXMAPDATA_P_H diff --git a/src/gui/image/qplatformpixmap_qpa.h b/src/gui/image/qplatformpixmap_qpa.h deleted file mode 100644 index 154c5079a7..0000000000 --- a/src/gui/image/qplatformpixmap_qpa.h +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPIXMAPDATA_P_H -#define QPIXMAPDATA_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - - -class QImageReader; - -class Q_GUI_EXPORT QPlatformPixmap -{ -public: - enum PixelType { - // WARNING: Do not change the first two - // Must match QPixmap::Type - PixmapType, BitmapType - }; - - enum ClassId { RasterClass, DirectFBClass, - BlitterClass, CustomClass = 1024 }; - - QPlatformPixmap(PixelType pixelType, int classId); - virtual ~QPlatformPixmap(); - - virtual QPlatformPixmap *createCompatiblePlatformPixmap() const; - - virtual void resize(int width, int height) = 0; - virtual void fromImage(const QImage &image, - Qt::ImageConversionFlags flags) = 0; - virtual void fromImageReader(QImageReader *imageReader, - Qt::ImageConversionFlags flags); - - virtual bool fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags); - virtual bool fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags); - - virtual void copy(const QPlatformPixmap *data, const QRect &rect); - virtual bool scroll(int dx, int dy, const QRect &rect); - - virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0; - virtual void fill(const QColor &color) = 0; - - virtual bool hasAlphaChannel() const = 0; - virtual QPixmap transformed(const QTransform &matrix, - Qt::TransformationMode mode) const; - - virtual QImage toImage() const = 0; - virtual QImage toImage(const QRect &rect) const; - virtual QPaintEngine* paintEngine() const = 0; - - inline int serialNumber() const { return ser_no; } - - inline PixelType pixelType() const { return type; } - inline ClassId classId() const { return static_cast(id); } - - virtual QImage* buffer(); - - inline int width() const { return w; } - inline int height() const { return h; } - inline int colorCount() const { return metric(QPaintDevice::PdmNumColors); } - inline int depth() const { return d; } - inline bool isNull() const { return is_null; } - inline qint64 cacheKey() const { - int classKey = id; - if (classKey >= 1024) - classKey = -(classKey >> 10); - return ((((qint64) classKey) << 56) - | (((qint64) ser_no) << 32) - | ((qint64) detach_no)); - } - - static QPlatformPixmap *create(int w, int h, PixelType type); - -protected: - - void setSerialNumber(int serNo); - int w; - int h; - int d; - bool is_null; - -private: - friend class QPixmap; - friend class QImagePixmapCleanupHooks; // Needs to set is_cached - friend class QOpenGLTextureCache; //Needs to check the reference count - friend class QExplicitlySharedDataPointer; - - QAtomicInt ref; - int detach_no; - - PixelType type; - int id; - int ser_no; - uint is_cached; -}; - -# define QT_XFORM_TYPE_MSBFIRST 0 -# define QT_XFORM_TYPE_LSBFIRST 1 -extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int); - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPIXMAPDATA_P_H -- cgit v1.2.3