source: trunk/src/gui/egl/qegl_p.h@ 651

Last change on this file since 651 was 651, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.2 sources.

  • Property svn:eol-style set to native
File size: 4.6 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtGui module 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 [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QEGL_P_H
43#define QEGL_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 of
50// the QtOpenGL and QtOpenVG modules. This header file may change from
51// version to version without notice, or even be removed.
52//
53// We mean it.
54//
55
56#include <QtCore/qsize.h>
57#include <QtGui/qimage.h>
58
59#include <private/qeglproperties_p.h>
60
61QT_BEGIN_INCLUDE_NAMESPACE
62
63#if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED)
64#undef EGLNativeWindowType
65#undef EGLNativePixmapType
66#undef EGLNativeDisplayType
67typedef NativeWindowType EGLNativeWindowType;
68typedef NativePixmapType EGLNativePixmapType;
69typedef NativeDisplayType EGLNativeDisplayType;
70#define QEGL_NATIVE_TYPES_DEFINED 1
71#endif
72QT_END_INCLUDE_NAMESPACE
73
74QT_BEGIN_NAMESPACE
75
76class Q_GUI_EXPORT QEglContext
77{
78public:
79 QEglContext();
80 ~QEglContext();
81
82 bool isValid() const;
83 bool isCurrent() const;
84 bool isSharing() const { return sharing; }
85
86 QEgl::API api() const { return apiType; }
87 void setApi(QEgl::API api) { apiType = api; }
88
89 bool openDisplay(QPaintDevice *device);
90 bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat);
91 bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0);
92 EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0);
93 void destroySurface(EGLSurface surface);
94
95 void destroy();
96
97 bool makeCurrent(EGLSurface surface);
98 bool doneCurrent();
99 bool lazyDoneCurrent();
100 bool swapBuffers(EGLSurface surface);
101
102 void waitNative();
103 void waitClient();
104
105 bool configAttrib(int name, EGLint *value) const;
106
107 static void clearError() { eglGetError(); }
108 static EGLint error() { return eglGetError(); }
109 static QString errorString(EGLint code);
110
111 EGLDisplay display() const { return dpy; }
112
113 EGLContext context() const { return ctx; }
114 void setContext(EGLContext context) { ctx = context; ownsContext = false;}
115
116 EGLConfig config() const { return cfg; }
117 void setConfig(EGLConfig config) { cfg = config; }
118
119 QEglProperties configProperties(EGLConfig cfg = 0) const;
120
121 static EGLDisplay defaultDisplay(QPaintDevice *device);
122
123 void dumpAllConfigs();
124
125 static QString extensions();
126 static bool hasExtension(const char* extensionName);
127
128private:
129 QEgl::API apiType;
130 EGLDisplay dpy;
131 EGLContext ctx;
132 EGLConfig cfg;
133 EGLSurface currentSurface;
134 bool current;
135 bool ownsContext;
136 bool sharing;
137
138 static EGLDisplay getDisplay(QPaintDevice *device);
139
140 static QEglContext *currentContext(QEgl::API api);
141 static void setCurrentContext(QEgl::API api, QEglContext *context);
142};
143
144QT_END_NAMESPACE
145
146#endif // QEGL_P_H
Note: See TracBrowser for help on using the repository browser.