summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-02-16 08:38:23 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-03-02 08:24:23 (GMT)
commit56d32b57814cb35409bc9b0076ec753de488ae7f (patch)
tree34c96cff78ea5cbfb128a72c2b9a86bf2e63a86b /src/gui
parentb2b9dc03fc01a8387e74591642fa15b272845e2b (diff)
downloadQt-56d32b57814cb35409bc9b0076ec753de488ae7f.zip
Qt-56d32b57814cb35409bc9b0076ec753de488ae7f.tar.gz
Qt-56d32b57814cb35409bc9b0076ec753de488ae7f.tar.bz2
Move qegl_p.h -> qeglcontext_p.h and add a new qegl_p.h
This puts the QEgl namespace in a single file which can be used by both qeglcontext and qeglproperties. Files which need QEglContext should now include qeglcontext_p.h. Reviewed-By: Aleksandar Sasha Babic
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/egl/egl.pri1
-rw-r--r--src/gui/egl/qegl.cpp3
-rw-r--r--src/gui/egl/qegl_p.h108
-rw-r--r--src/gui/egl/qegl_qws.cpp2
-rw-r--r--src/gui/egl/qegl_symbian.cpp2
-rw-r--r--src/gui/egl/qegl_wince.cpp2
-rw-r--r--src/gui/egl/qegl_x11.cpp3
-rw-r--r--src/gui/egl/qeglcontext_p.h130
-rw-r--r--src/gui/egl/qeglproperties.cpp3
-rw-r--r--src/gui/egl/qeglproperties_p.h42
10 files changed, 186 insertions, 110 deletions
diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri
index 669d311..b90b9b0 100644
--- a/src/gui/egl/egl.pri
+++ b/src/gui/egl/egl.pri
@@ -2,6 +2,7 @@ CONFIG += egl
HEADERS += \
egl/qegl_p.h \
+ egl/qeglcontext_p.h \
egl/qeglproperties_p.h
SOURCES += \
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 0ed95ea..5052dfc 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -43,7 +43,10 @@
#include <QtGui/qpixmap.h>
#include <QtGui/qwidget.h>
#include <QtCore/qdebug.h>
+
#include "qegl_p.h"
+#include "qeglcontext_p.h"
+
QT_BEGIN_NAMESPACE
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 87ed818..eb83002 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -53,13 +53,34 @@
// We mean it.
//
-#include <QtCore/qsize.h>
-#include <QtGui/qimage.h>
+QT_BEGIN_INCLUDE_NAMESPACE
-#include <private/qeglproperties_p.h>
+#if defined(QT_GLES_EGL)
+#include <GLES/egl.h>
+#else
+#include <EGL/egl.h>
+#endif
-QT_BEGIN_INCLUDE_NAMESPACE
+#if defined(Q_WS_X11)
+// If <EGL/egl.h> included <X11/Xlib.h>, then the global namespace
+// may have been polluted with X #define's. The following makes sure
+// the X11 headers were included properly and then cleans things up.
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#undef Bool
+#undef Status
+#undef None
+#undef KeyPress
+#undef KeyRelease
+#undef FocusIn
+#undef FocusOut
+#undef Type
+#undef FontChange
+#undef CursorShape
+#endif
+// Internally we use the EGL-prefixed native types which are used in EGL >= 1.3.
+// For older versions of EGL, we have to define these types ourselves here:
#if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED)
#undef EGLNativeWindowType
#undef EGLNativePixmapType
@@ -69,74 +90,27 @@ typedef NativePixmapType EGLNativePixmapType;
typedef NativeDisplayType EGLNativeDisplayType;
#define QEGL_NATIVE_TYPES_DEFINED 1
#endif
-QT_END_INCLUDE_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class Q_GUI_EXPORT QEglContext
-{
-public:
- QEglContext();
- ~QEglContext();
-
- bool isValid() const;
- bool isCurrent() const;
- bool isSharing() const { return sharing; }
-
- QEgl::API api() const { return apiType; }
- void setApi(QEgl::API api) { apiType = api; }
-
- bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat);
- bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0);
- void destroyContext();
- EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0);
- void destroySurface(EGLSurface surface);
-
- bool makeCurrent(EGLSurface surface);
- bool doneCurrent();
- bool lazyDoneCurrent();
- bool swapBuffers(EGLSurface surface);
- void waitNative();
- void waitClient();
-
- bool configAttrib(int name, EGLint *value) const;
-
- static void clearError() { eglGetError(); }
- static EGLint error() { return eglGetError(); }
- static QString errorString(EGLint code);
-
- static EGLDisplay display();
-
- EGLContext context() const { return ctx; }
- void setContext(EGLContext context) { ctx = context; ownsContext = false;}
-
- EGLConfig config() const { return cfg; }
- void setConfig(EGLConfig config) { cfg = config; }
-
- QEglProperties configProperties(EGLConfig cfg = 0) const;
-
- void dumpAllConfigs();
-
- static QString extensions();
- static bool hasExtension(const char* extensionName);
+QT_END_INCLUDE_NAMESPACE
-private:
- QEgl::API apiType;
- EGLContext ctx;
- EGLConfig cfg;
- EGLSurface currentSurface;
- bool current;
- bool ownsContext;
- bool sharing;
- static EGLDisplay dpy;
- static EGLNativeDisplayType nativeDisplay();
+QT_BEGIN_NAMESPACE
- static QEglContext *currentContext(QEgl::API api);
- static void setCurrentContext(QEgl::API api, QEglContext *context);
+namespace QEgl {
+ enum API
+ {
+ OpenGL,
+ OpenVG
+ };
+
+ enum PixelFormatMatch
+ {
+ ExactPixelFormat,
+ BestPixelFormat
+ };
};
+
QT_END_NAMESPACE
-#endif // QEGL_P_H
+#endif //QEGL_P_H
diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp
index 2a61beb..a40c236 100644
--- a/src/gui/egl/qegl_qws.cpp
+++ b/src/gui/egl/qegl_qws.cpp
@@ -42,7 +42,9 @@
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qwidget.h>
+
#include "qegl_p.h"
+#include "qeglcontext_p.h"
#if !defined(QT_NO_EGL)
diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp
index 5a010cd..0c91fd8 100644
--- a/src/gui/egl/qegl_symbian.cpp
+++ b/src/gui/egl/qegl_symbian.cpp
@@ -42,7 +42,9 @@
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qwidget.h>
+
#include "qegl_p.h"
+#include "qeglcontext_p.h"
#include <coecntrl.h>
diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp
index c9c9773..00341ba 100644
--- a/src/gui/egl/qegl_wince.cpp
+++ b/src/gui/egl/qegl_wince.cpp
@@ -42,7 +42,9 @@
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qwidget.h>
+
#include "qegl_p.h"
+#include "qeglcontext_p.h"
#include <windows.h>
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 634ff13..cd55849 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -49,8 +49,9 @@
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpixmap.h>
#include <QtGui/qwidget.h>
-#include "qegl_p.h"
+#include "qegl_p.h"
+#include "qeglcontext_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h
new file mode 100644
index 0000000..3857fb7
--- /dev/null
+++ b/src/gui/egl/qeglcontext_p.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QEGLCONTEXT_P_H
+#define QEGLCONTEXT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience of
+// the QtOpenGL and QtOpenVG modules. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qsize.h>
+#include <QtGui/qimage.h>
+
+#include <QtGui/private/qegl_p.h>
+#include <QtGui/private/qeglproperties_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QEglContext
+{
+public:
+ QEglContext();
+ ~QEglContext();
+
+ bool isValid() const;
+ bool isCurrent() const;
+ bool isSharing() const { return sharing; }
+
+ QEgl::API api() const { return apiType; }
+ void setApi(QEgl::API api) { apiType = api; }
+
+ bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat);
+ bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0);
+ void destroyContext();
+ EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0);
+ void destroySurface(EGLSurface surface);
+
+ bool makeCurrent(EGLSurface surface);
+ bool doneCurrent();
+ bool lazyDoneCurrent();
+ bool swapBuffers(EGLSurface surface);
+
+ void waitNative();
+ void waitClient();
+
+ bool configAttrib(int name, EGLint *value) const;
+
+ static void clearError() { eglGetError(); }
+ static EGLint error() { return eglGetError(); }
+ static QString errorString(EGLint code);
+
+ static EGLDisplay display();
+
+ EGLContext context() const { return ctx; }
+ void setContext(EGLContext context) { ctx = context; ownsContext = false;}
+
+ EGLConfig config() const { return cfg; }
+ void setConfig(EGLConfig config) { cfg = config; }
+
+ QEglProperties configProperties(EGLConfig cfg = 0) const;
+
+ void dumpAllConfigs();
+
+ static QString extensions();
+ static bool hasExtension(const char* extensionName);
+
+private:
+ QEgl::API apiType;
+ EGLContext ctx;
+ EGLConfig cfg;
+ EGLSurface currentSurface;
+ bool current;
+ bool ownsContext;
+ bool sharing;
+
+ static EGLDisplay dpy;
+ static EGLNativeDisplayType nativeDisplay();
+
+ static QEglContext *currentContext(QEgl::API api);
+ static void setCurrentContext(QEgl::API api, QEglContext *context);
+};
+
+QT_END_NAMESPACE
+
+#endif // QEGLCONTEXT_P_H
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index 236ec37..b83ae4e 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -46,7 +46,8 @@ QT_BEGIN_NAMESPACE
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
-#include "qegl_p.h"
+#include "qeglproperties_p.h"
+#include "qeglcontext_p.h"
// Initialize a property block.
diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h
index feed1d2..496847b 100644
--- a/src/gui/egl/qeglproperties_p.h
+++ b/src/gui/egl/qeglproperties_p.h
@@ -56,50 +56,10 @@
#include <QtCore/qvarlengtharray.h>
#include <QtGui/qimage.h>
-QT_BEGIN_INCLUDE_NAMESPACE
-
-#if defined(QT_GLES_EGL)
-#include <GLES/egl.h>
-#else
-#include <EGL/egl.h>
-#endif
-
-#if defined(Q_WS_X11)
-// If <EGL/egl.h> included <X11/Xlib.h>, then the global namespace
-// may have been polluted with X #define's. The following makes sure
-// the X11 headers were included properly and then cleans things up.
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#undef Bool
-#undef Status
-#undef None
-#undef KeyPress
-#undef KeyRelease
-#undef FocusIn
-#undef FocusOut
-#undef Type
-#undef FontChange
-#undef CursorShape
-#endif
-
-QT_END_INCLUDE_NAMESPACE
+#include <QtGui/private/qegl_p.h>
QT_BEGIN_NAMESPACE
-namespace QEgl {
- enum API
- {
- OpenGL,
- OpenVG
- };
-
- enum PixelFormatMatch
- {
- ExactPixelFormat,
- BestPixelFormat
- };
-};
-
class QX11Info;
class QPaintDevice;