source: trunk/src/gui/painting/qgraphicssystem_runtime_p.h

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 6.1 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation (qt-info@nokia.com)
6**
7** This file is part of the plugins of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at qt-info@nokia.com.
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QGRAPHICSSYSTEM_RUNTIME_P_H
43#define QGRAPHICSSYSTEM_RUNTIME_P_H
44
45//
46// W A R N I N G
47// -------------
48//
49// This file is not part of the Qt API. It exists for the convenience
50// of other Qt classes. This header file may change from version to
51// version without notice, or even be removed.
52//
53// We mean it.
54//
55
56#include "qgraphicssystem_p.h"
57
58#include <private/qpixmapdata_p.h>
59
60QT_BEGIN_NAMESPACE
61
62class QRuntimeGraphicsSystem;
63
64class Q_GUI_EXPORT QRuntimePixmapData : public QPixmapData {
65public:
66 QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type);
67 ~QRuntimePixmapData();
68
69 virtual QPixmapData *createCompatiblePixmapData() const;
70 virtual void resize(int width, int height);
71 virtual void fromImage(const QImage &image,
72 Qt::ImageConversionFlags flags);
73
74 virtual bool fromFile(const QString &filename, const char *format,
75 Qt::ImageConversionFlags flags);
76 virtual bool fromData(const uchar *buffer, uint len, const char *format,
77 Qt::ImageConversionFlags flags);
78
79 virtual void copy(const QPixmapData *data, const QRect &rect);
80 virtual bool scroll(int dx, int dy, const QRect &rect);
81
82 virtual int metric(QPaintDevice::PaintDeviceMetric metric) const;
83 virtual void fill(const QColor &color);
84 virtual QBitmap mask() const;
85 virtual void setMask(const QBitmap &mask);
86 virtual bool hasAlphaChannel() const;
87 virtual QPixmap transformed(const QTransform &matrix,
88 Qt::TransformationMode mode) const;
89 virtual void setAlphaChannel(const QPixmap &alphaChannel);
90 virtual QPixmap alphaChannel() const;
91 virtual QImage toImage() const;
92 virtual QPaintEngine *paintEngine() const;
93
94 virtual QImage *buffer();
95
96 void readBackInfo();
97
98 QPixmapData *m_data;
99
100#if defined(Q_OS_SYMBIAN)
101 void* toNativeType(NativeType type);
102 void fromNativeType(void* pixmap, NativeType type);
103#endif
104
105 virtual QPixmapData *runtimeData() const;
106
107private:
108 const QRuntimeGraphicsSystem *m_graphicsSystem;
109
110};
111
112class QRuntimeWindowSurface : public QWindowSurface {
113public:
114 QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window);
115 ~QRuntimeWindowSurface();
116
117 virtual QPaintDevice *paintDevice();
118 virtual void flush(QWidget *widget, const QRegion &region,
119 const QPoint &offset);
120 virtual void setGeometry(const QRect &rect);
121
122 virtual bool scroll(const QRegion &area, int dx, int dy);
123
124 virtual void beginPaint(const QRegion &);
125 virtual void endPaint(const QRegion &);
126
127 virtual QImage* buffer(const QWidget *widget);
128 virtual QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const;
129
130 virtual QPoint offset(const QWidget *widget) const;
131
132 QScopedPointer<QWindowSurface> m_windowSurface;
133 QScopedPointer<QWindowSurface> m_pendingWindowSurface;
134
135private:
136 const QRuntimeGraphicsSystem *m_graphicsSystem;
137};
138
139class QRuntimeGraphicsSystem : public QGraphicsSystem
140{
141public:
142
143 enum WindowSurfaceDestroyPolicy
144 {
145 DestroyImmediately,
146 DestroyAfterFirstFlush
147 };
148
149public:
150 QRuntimeGraphicsSystem();
151
152 QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
153 QWindowSurface *createWindowSurface(QWidget *widget) const;
154
155 void removePixmapData(QRuntimePixmapData *pixmapData) const;
156 void removeWindowSurface(QRuntimeWindowSurface *windowSurface) const;
157
158 void setGraphicsSystem(const QString &name);
159 QString graphicsSystemName() const { return m_graphicsSystemName; }
160
161 void setWindowSurfaceDestroyPolicy(WindowSurfaceDestroyPolicy policy)
162 {
163 m_windowSurfaceDestroyPolicy = policy;
164 }
165
166 int windowSurfaceDestroyPolicy() const { return m_windowSurfaceDestroyPolicy; }
167
168
169private:
170 int m_windowSurfaceDestroyPolicy;
171 QGraphicsSystem *m_graphicsSystem;
172 mutable QList<QRuntimePixmapData *> m_pixmapDatas;
173 mutable QList<QRuntimeWindowSurface *> m_windowSurfaces;
174 QString m_graphicsSystemName;
175
176 QString m_pendingGraphicsSystemName;
177
178 friend class QRuntimePixmapData;
179 friend class QRuntimeWindowSurface;
180 friend class QMeeGoGraphicsSystem;
181};
182
183QT_END_NAMESPACE
184
185#endif
Note: See TracBrowser for help on using the repository browser.