summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-04-23 07:39:40 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-04-23 07:49:48 (GMT)
commit41b110e17b3deb102c7521d19964896228fcc8c6 (patch)
tree687809a25deb02532be742e13da8dc95e2c13728 /src/gui
parent2ca4e77f0a29bc6d7571ca614a6101d9e1bd83e0 (diff)
downloadQt-41b110e17b3deb102c7521d19964896228fcc8c6.zip
Qt-41b110e17b3deb102c7521d19964896228fcc8c6.tar.gz
Qt-41b110e17b3deb102c7521d19964896228fcc8c6.tar.bz2
Stub implementations for EGL for symbian
This is done to keep binary compatibility between Qt built with openvg vs Qt built without openvg support. The problem is that Symbian uses .def files to map between exported symbol names and ordinals in the DLL export table. The alternative of manually maintaining two versions of the QtGui def files proved to be too error prone and time consuming. Note that the EGL exports are defined in a private header, for use by the openvg and opengl graphics system plugins. These plugins should always be compiled against Qt configured with support for the graphics system, as the headers contain default parameters which are inlined into the plugin binary. Task-number: QTBUG-7870 Reviewed-by: Tom Cooksey
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/egl/egl.pri43
-rw-r--r--src/gui/egl/qegl_p.h28
-rw-r--r--src/gui/egl/qegl_stub.cpp292
-rw-r--r--src/gui/egl/qeglproperties_stub.cpp148
-rw-r--r--src/gui/gui.pro3
5 files changed, 490 insertions, 24 deletions
diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri
index b90b9b0..9ca1f0a 100644
--- a/src/gui/egl/egl.pri
+++ b/src/gui/egl/egl.pri
@@ -1,24 +1,29 @@
-CONFIG += egl
+contains(QT_CONFIG, egl): {
+ CONFIG += egl
-HEADERS += \
- egl/qegl_p.h \
- egl/qeglcontext_p.h \
- egl/qeglproperties_p.h
+ HEADERS += \
+ egl/qegl_p.h \
+ egl/qeglcontext_p.h \
+ egl/qeglproperties_p.h
-SOURCES += \
- egl/qegl.cpp \
- egl/qeglproperties.cpp
+ SOURCES += \
+ egl/qegl.cpp \
+ egl/qeglproperties.cpp
-wince*: SOURCES += egl/qegl_wince.cpp
+ wince*: SOURCES += egl/qegl_wince.cpp
-unix {
- embedded {
- SOURCES += egl/qegl_qws.cpp
- } else {
- symbian {
- SOURCES += egl/qegl_symbian.cpp
- } else {
- SOURCES += egl/qegl_x11.cpp
- }
- }
+ unix {
+ embedded {
+ SOURCES += egl/qegl_qws.cpp
+ } else {
+ symbian {
+ SOURCES += egl/qegl_symbian.cpp
+ } else {
+ SOURCES += egl/qegl_x11.cpp
+ }
+ }
+ }
+} else:symbian {
+ SOURCES += egl/qegl_stub.cpp
+ SOURCES += egl/qeglproperties_stub.cpp
}
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 83bdb5e..6c562ef 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -55,6 +55,7 @@
QT_BEGIN_INCLUDE_NAMESPACE
+#ifndef QT_NO_EGL
#if defined(QT_OPENGL_ES_2)
# include <GLES2/gl2.h>
#endif
@@ -64,6 +65,23 @@ QT_BEGIN_INCLUDE_NAMESPACE
#else
# include <EGL/egl.h>
#endif
+#else
+
+//types from egltypes.h for compiling stub without EGL headers
+typedef int EGLBoolean;
+typedef int EGLint;
+typedef int EGLenum;
+typedef int NativeDisplayType;
+typedef void* NativeWindowType;
+typedef void* NativePixmapType;
+typedef int EGLDisplay;
+typedef int EGLConfig;
+typedef int EGLSurface;
+typedef int EGLContext;
+typedef int EGLClientBuffer;
+#define EGL_NONE 0x3038 /* Attrib list terminator */
+
+#endif
#if defined(Q_WS_X11)
// If <EGL/egl.h> included <X11/Xlib.h>, then the global namespace
@@ -169,7 +187,7 @@ namespace QEgl {
Translucent = 0x01,
Renderable = 0x02 // Config will be compatable with the paint engines (VG or GL)
};
- Q_DECLARE_FLAGS(ConfigOptions, ConfigOption);
+ Q_DECLARE_FLAGS(ConfigOptions, ConfigOption)
// Most of the time we use the same config for things like widgets & pixmaps, so rather than
// go through the eglChooseConfig loop every time, we use defaultConfig, which will return
@@ -182,7 +200,11 @@ namespace QEgl {
Q_GUI_EXPORT void dumpAllConfigs();
+#ifdef QT_NO_EGL
+ Q_GUI_EXPORT QString errorString(EGLint code = 0);
+#else
Q_GUI_EXPORT QString errorString(EGLint code = eglGetError());
+#endif
Q_GUI_EXPORT QString extensions();
Q_GUI_EXPORT bool hasExtension(const char* extensionName);
@@ -200,9 +222,9 @@ namespace QEgl {
#ifdef Q_WS_X11
Q_GUI_EXPORT VisualID getCompatibleVisualId(EGLConfig config);
#endif
-};
+}
-Q_DECLARE_OPERATORS_FOR_FLAGS(QEgl::ConfigOptions);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QEgl::ConfigOptions)
QT_END_NAMESPACE
diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp
new file mode 100644
index 0000000..0bd3451
--- /dev/null
+++ b/src/gui/egl/qegl_stub.cpp
@@ -0,0 +1,292 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/qpaintdevice.h>
+#include <QtGui/qpixmap.h>
+#include <QtGui/qwidget.h>
+#include <QtCore/qdebug.h>
+
+#include "qegl_p.h"
+#include "qeglcontext_p.h"
+
+
+QT_BEGIN_NAMESPACE
+
+static void noegl(const char *fn)
+{
+ qWarning() << fn << " called, but Qt configured without EGL" << endl;
+}
+
+#define NOEGL noegl(__FUNCTION__);
+
+QEglContext::QEglContext()
+ : apiType(QEgl::OpenGL)
+ , ctx(0)
+ , cfg(QEGL_NO_CONFIG)
+ , currentSurface(0)
+ , current(false)
+ , ownsContext(true)
+ , sharing(false)
+{
+ NOEGL
+}
+
+QEglContext::~QEglContext()
+{
+ NOEGL
+}
+
+bool QEglContext::isValid() const
+{
+ NOEGL
+ return false;
+}
+
+bool QEglContext::isCurrent() const
+{
+ NOEGL
+ return false;
+}
+
+EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options)
+{
+ Q_UNUSED(devType)
+ Q_UNUSED(api)
+ Q_UNUSED(options)
+ NOEGL
+ return QEGL_NO_CONFIG;
+}
+
+
+// Choose a configuration that matches "properties".
+EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match)
+{
+ Q_UNUSED(properties)
+ Q_UNUSED(match)
+ NOEGL
+ return QEGL_NO_CONFIG;
+}
+
+bool QEglContext::chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match)
+{
+ Q_UNUSED(properties)
+ Q_UNUSED(match)
+ NOEGL
+ return false;
+}
+
+EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties *properties)
+{
+ Q_UNUSED(device)
+ Q_UNUSED(properties)
+ NOEGL
+ return 0;
+}
+
+
+// Create the EGLContext.
+bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties *properties)
+{
+ Q_UNUSED(shareContext)
+ Q_UNUSED(properties)
+ NOEGL
+ return false;
+}
+
+// Destroy an EGL surface object. If it was current on this context
+// then call doneCurrent() for it first.
+void QEglContext::destroySurface(EGLSurface surface)
+{
+ Q_UNUSED(surface)
+ NOEGL
+}
+
+// Destroy the context. Note: this does not destroy the surface.
+void QEglContext::destroyContext()
+{
+ NOEGL
+}
+
+bool QEglContext::makeCurrent(EGLSurface surface)
+{
+ Q_UNUSED(surface)
+ NOEGL
+ return false;
+}
+
+bool QEglContext::doneCurrent()
+{
+ NOEGL
+ return false;
+}
+
+// Act as though doneCurrent() was called, but keep the context
+// and the surface active for the moment. This allows makeCurrent()
+// to skip a call to eglMakeCurrent() if we are using the same
+// surface as the last set of painting operations. We leave the
+// currentContext() pointer as-is for now.
+bool QEglContext::lazyDoneCurrent()
+{
+ NOEGL
+ return false;
+}
+
+bool QEglContext::swapBuffers(EGLSurface surface)
+{
+ Q_UNUSED(surface)
+ NOEGL
+ return false;
+}
+
+int QEglContext::configAttrib(int name) const
+{
+ Q_UNUSED(name)
+ NOEGL
+ return 0;
+}
+
+typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*);
+typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR);
+
+// Defined in qegl.cpp:
+static _eglCreateImageKHR qt_eglCreateImageKHR = 0;
+static _eglDestroyImageKHR qt_eglDestroyImageKHR = 0;
+
+
+EGLDisplay QEgl::display()
+{
+ NOEGL
+ return 0;
+}
+
+EGLImageKHR QEgl::eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
+{
+ Q_UNUSED(dpy)
+ Q_UNUSED(ctx)
+ Q_UNUSED(target)
+ Q_UNUSED(buffer)
+ Q_UNUSED(attrib_list)
+ NOEGL
+ return 0;
+}
+
+EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
+{
+ Q_UNUSED(dpy)
+ Q_UNUSED(img)
+ NOEGL
+ return 0;
+}
+
+
+#ifndef Q_WS_X11
+EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
+{
+ Q_UNUSED(device)
+ Q_UNUSED(cfg)
+ Q_UNUSED(properties)
+ NOEGL
+ return 0;
+}
+#endif
+
+
+// Return the error string associated with a specific code.
+QString QEgl::errorString(EGLint code)
+{
+ Q_UNUSED(code)
+ NOEGL
+ return QString();
+}
+
+// Dump all of the EGL configurations supported by the system.
+void QEgl::dumpAllConfigs()
+{
+ NOEGL
+}
+
+QString QEgl::extensions()
+{
+ NOEGL
+ return QString();
+}
+
+bool QEgl::hasExtension(const char* extensionName)
+{
+ Q_UNUSED(extensionName)
+ NOEGL
+ return false;
+}
+
+QEglContext *QEglContext::currentContext(QEgl::API api)
+{
+ Q_UNUSED(api)
+ NOEGL
+ return false;
+}
+
+void QEglContext::setCurrentContext(QEgl::API api, QEglContext *context)
+{
+ Q_UNUSED(api)
+ Q_UNUSED(context)
+ NOEGL
+}
+
+EGLNativeDisplayType QEgl::nativeDisplay()
+{
+ NOEGL
+ return 0;
+}
+
+EGLNativeWindowType QEgl::nativeWindow(QWidget* widget)
+{
+ Q_UNUSED(widget)
+ NOEGL
+ return (EGLNativeWindowType)0;
+}
+
+EGLNativePixmapType QEgl::nativePixmap(QPixmap*)
+{
+ NOEGL
+ return (EGLNativePixmapType)0;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/egl/qeglproperties_stub.cpp b/src/gui/egl/qeglproperties_stub.cpp
new file mode 100644
index 0000000..2012ebd
--- /dev/null
+++ b/src/gui/egl/qeglproperties_stub.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qstringlist.h>
+
+#include "qeglproperties_p.h"
+#include "qeglcontext_p.h"
+
+QT_BEGIN_NAMESPACE
+
+static void noegl(const char *fn)
+{
+ qWarning() << fn << " called, but Qt configured without EGL" << endl;
+}
+
+#define NOEGL noegl(__FUNCTION__);
+
+// Initialize a property block.
+QEglProperties::QEglProperties()
+{
+ NOEGL
+}
+
+QEglProperties::QEglProperties(EGLConfig cfg)
+{
+ Q_UNUSED(cfg)
+ NOEGL
+}
+
+// Fetch the current value associated with a property.
+int QEglProperties::value(int name) const
+{
+ Q_UNUSED(name)
+ NOEGL
+ return 0;
+}
+
+// Set the value associated with a property, replacing an existing
+// value if there is one.
+void QEglProperties::setValue(int name, int value)
+{
+ Q_UNUSED(name)
+ Q_UNUSED(value)
+ NOEGL
+}
+
+// Remove a property value. Returns false if the property is not present.
+bool QEglProperties::removeValue(int name)
+{
+ Q_UNUSED(name)
+ NOEGL
+ return false;
+}
+
+void QEglProperties::setDeviceType(int devType)
+{
+ Q_UNUSED(devType)
+ NOEGL
+}
+
+
+// Sets the red, green, blue, and alpha sizes based on a pixel format.
+// Normally used to match a configuration request to the screen format.
+void QEglProperties::setPixelFormat(QImage::Format pixelFormat)
+{
+ Q_UNUSED(pixelFormat)
+ NOEGL
+
+}
+
+void QEglProperties::setRenderableType(QEgl::API api)
+{
+ Q_UNUSED(api);
+ NOEGL
+}
+
+// Reduce the complexity of a configuration request to ask for less
+// because the previous request did not result in success. Returns
+// true if the complexity was reduced, or false if no further
+// reductions in complexity are possible.
+bool QEglProperties::reduceConfiguration()
+{
+ NOEGL
+ return false;
+}
+
+static void addTag(QString& str, const QString& tag)
+{
+ Q_UNUSED(str)
+ Q_UNUSED(tag)
+ NOEGL
+}
+
+// Convert a property list to a string suitable for debug output.
+QString QEglProperties::toString() const
+{
+ NOEGL
+ return QString();
+}
+
+void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev)
+{
+ Q_UNUSED(dev)
+ NOEGL
+}
+
+QT_END_NAMESPACE
+
+
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 300a03f..a6370b2 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -40,9 +40,8 @@ include(statemachine/statemachine.pri)
include(math3d/math3d.pri)
include(effects/effects.pri)
-contains(QT_CONFIG, egl): include(egl/egl.pri)
+include(egl/egl.pri)
win32:!wince*: DEFINES += QT_NO_EGL
-
embedded: QT += network
QMAKE_LIBS += $$QMAKE_LIBS_GUI