|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 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 QtGui module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
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 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include <QtGui/qpaintdevice.h> |
|
43 #include <QtGui/qpixmap.h> |
|
44 #include <QtGui/qwidget.h> |
|
45 #include <QtCore/qdebug.h> |
|
46 |
|
47 #include "qegl_p.h" |
|
48 #include "qeglcontext_p.h" |
|
49 |
|
50 |
|
51 QT_BEGIN_NAMESPACE |
|
52 |
|
53 static void noegl(const char *fn) |
|
54 { |
|
55 qWarning() << fn << " called, but Qt configured without EGL" << endl; |
|
56 } |
|
57 |
|
58 #define NOEGL noegl(__FUNCTION__); |
|
59 |
|
60 QEglContext::QEglContext() |
|
61 : apiType(QEgl::OpenGL) |
|
62 , ctx(0) |
|
63 , cfg(QEGL_NO_CONFIG) |
|
64 , currentSurface(0) |
|
65 , current(false) |
|
66 , ownsContext(true) |
|
67 , sharing(false) |
|
68 { |
|
69 NOEGL |
|
70 } |
|
71 |
|
72 QEglContext::~QEglContext() |
|
73 { |
|
74 NOEGL |
|
75 } |
|
76 |
|
77 bool QEglContext::isValid() const |
|
78 { |
|
79 NOEGL |
|
80 return false; |
|
81 } |
|
82 |
|
83 bool QEglContext::isCurrent() const |
|
84 { |
|
85 NOEGL |
|
86 return false; |
|
87 } |
|
88 |
|
89 EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options) |
|
90 { |
|
91 Q_UNUSED(devType) |
|
92 Q_UNUSED(api) |
|
93 Q_UNUSED(options) |
|
94 NOEGL |
|
95 return QEGL_NO_CONFIG; |
|
96 } |
|
97 |
|
98 |
|
99 // Choose a configuration that matches "properties". |
|
100 EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match) |
|
101 { |
|
102 Q_UNUSED(properties) |
|
103 Q_UNUSED(match) |
|
104 NOEGL |
|
105 return QEGL_NO_CONFIG; |
|
106 } |
|
107 |
|
108 bool QEglContext::chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match) |
|
109 { |
|
110 Q_UNUSED(properties) |
|
111 Q_UNUSED(match) |
|
112 NOEGL |
|
113 return false; |
|
114 } |
|
115 |
|
116 EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties *properties) |
|
117 { |
|
118 Q_UNUSED(device) |
|
119 Q_UNUSED(properties) |
|
120 NOEGL |
|
121 return 0; |
|
122 } |
|
123 |
|
124 |
|
125 // Create the EGLContext. |
|
126 bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties *properties) |
|
127 { |
|
128 Q_UNUSED(shareContext) |
|
129 Q_UNUSED(properties) |
|
130 NOEGL |
|
131 return false; |
|
132 } |
|
133 |
|
134 // Destroy an EGL surface object. If it was current on this context |
|
135 // then call doneCurrent() for it first. |
|
136 void QEglContext::destroySurface(EGLSurface surface) |
|
137 { |
|
138 Q_UNUSED(surface) |
|
139 NOEGL |
|
140 } |
|
141 |
|
142 // Destroy the context. Note: this does not destroy the surface. |
|
143 void QEglContext::destroyContext() |
|
144 { |
|
145 NOEGL |
|
146 } |
|
147 |
|
148 bool QEglContext::makeCurrent(EGLSurface surface) |
|
149 { |
|
150 Q_UNUSED(surface) |
|
151 NOEGL |
|
152 return false; |
|
153 } |
|
154 |
|
155 bool QEglContext::doneCurrent() |
|
156 { |
|
157 NOEGL |
|
158 return false; |
|
159 } |
|
160 |
|
161 // Act as though doneCurrent() was called, but keep the context |
|
162 // and the surface active for the moment. This allows makeCurrent() |
|
163 // to skip a call to eglMakeCurrent() if we are using the same |
|
164 // surface as the last set of painting operations. We leave the |
|
165 // currentContext() pointer as-is for now. |
|
166 bool QEglContext::lazyDoneCurrent() |
|
167 { |
|
168 NOEGL |
|
169 return false; |
|
170 } |
|
171 |
|
172 bool QEglContext::swapBuffers(EGLSurface surface) |
|
173 { |
|
174 Q_UNUSED(surface) |
|
175 NOEGL |
|
176 return false; |
|
177 } |
|
178 |
|
179 int QEglContext::configAttrib(int name) const |
|
180 { |
|
181 Q_UNUSED(name) |
|
182 NOEGL |
|
183 return 0; |
|
184 } |
|
185 |
|
186 EGLDisplay QEgl::display() |
|
187 { |
|
188 NOEGL |
|
189 return 0; |
|
190 } |
|
191 |
|
192 EGLImageKHR QEgl::eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) |
|
193 { |
|
194 Q_UNUSED(dpy) |
|
195 Q_UNUSED(ctx) |
|
196 Q_UNUSED(target) |
|
197 Q_UNUSED(buffer) |
|
198 Q_UNUSED(attrib_list) |
|
199 NOEGL |
|
200 return 0; |
|
201 } |
|
202 |
|
203 EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) |
|
204 { |
|
205 Q_UNUSED(dpy) |
|
206 Q_UNUSED(img) |
|
207 NOEGL |
|
208 return 0; |
|
209 } |
|
210 |
|
211 |
|
212 #ifndef Q_WS_X11 |
|
213 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) |
|
214 { |
|
215 Q_UNUSED(device) |
|
216 Q_UNUSED(cfg) |
|
217 Q_UNUSED(properties) |
|
218 NOEGL |
|
219 return 0; |
|
220 } |
|
221 #endif |
|
222 |
|
223 |
|
224 // Return the error string associated with a specific code. |
|
225 QString QEgl::errorString(EGLint code) |
|
226 { |
|
227 Q_UNUSED(code) |
|
228 NOEGL |
|
229 return QString(); |
|
230 } |
|
231 |
|
232 // Dump all of the EGL configurations supported by the system. |
|
233 void QEgl::dumpAllConfigs() |
|
234 { |
|
235 NOEGL |
|
236 } |
|
237 |
|
238 QString QEgl::extensions() |
|
239 { |
|
240 NOEGL |
|
241 return QString(); |
|
242 } |
|
243 |
|
244 bool QEgl::hasExtension(const char* extensionName) |
|
245 { |
|
246 Q_UNUSED(extensionName) |
|
247 NOEGL |
|
248 return false; |
|
249 } |
|
250 |
|
251 QEglContext *QEglContext::currentContext(QEgl::API api) |
|
252 { |
|
253 Q_UNUSED(api) |
|
254 NOEGL |
|
255 return false; |
|
256 } |
|
257 |
|
258 void QEglContext::setCurrentContext(QEgl::API api, QEglContext *context) |
|
259 { |
|
260 Q_UNUSED(api) |
|
261 Q_UNUSED(context) |
|
262 NOEGL |
|
263 } |
|
264 |
|
265 EGLNativeDisplayType QEgl::nativeDisplay() |
|
266 { |
|
267 NOEGL |
|
268 return 0; |
|
269 } |
|
270 |
|
271 EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) |
|
272 { |
|
273 Q_UNUSED(widget) |
|
274 NOEGL |
|
275 return (EGLNativeWindowType)0; |
|
276 } |
|
277 |
|
278 EGLNativePixmapType QEgl::nativePixmap(QPixmap*) |
|
279 { |
|
280 NOEGL |
|
281 return (EGLNativePixmapType)0; |
|
282 } |
|
283 |
|
284 QT_END_NAMESPACE |