Changeset 561 for trunk/src/opengl/qgl_egl.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/opengl/qgl_egl.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtOpenGL module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 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 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 41 41 42 42 #include <QtOpenGL/qgl.h> 43 #include "qgl_p.h" 43 44 #include "qgl_egl_p.h" 44 45 … … 58 59 // if the system hasn't already chosen a fixed format to 59 60 // match the pixmap, widget, etc. 60 if (props.value(EGL_RED_SIZE) == EGL_DONT_CARE|| f.redBufferSize() != -1)61 if (props.value(EGL_RED_SIZE) == 0 || f.redBufferSize() != -1) 61 62 props.setValue(EGL_RED_SIZE, f.redBufferSize() == -1 ? 1 : f.redBufferSize()); 62 if (props.value(EGL_GREEN_SIZE) == EGL_DONT_CARE|| f.greenBufferSize() != -1)63 if (props.value(EGL_GREEN_SIZE) == 0 || f.greenBufferSize() != -1) 63 64 props.setValue(EGL_GREEN_SIZE, f.greenBufferSize() == -1 ? 1 : f.greenBufferSize()); 64 if (props.value(EGL_BLUE_SIZE) == EGL_DONT_CARE|| f.blueBufferSize() != -1)65 if (props.value(EGL_BLUE_SIZE) == 0 || f.blueBufferSize() != -1) 65 66 props.setValue(EGL_BLUE_SIZE, f.blueBufferSize() == -1 ? 1 : f.blueBufferSize()); 66 67 if (f.alpha()) { 67 if (props.value(EGL_ALPHA_SIZE) == EGL_DONT_CARE|| f.alphaBufferSize() != -1)68 if (props.value(EGL_ALPHA_SIZE) == 0 || f.alphaBufferSize() != -1) 68 69 props.setValue(EGL_ALPHA_SIZE, f.alphaBufferSize() == -1 ? 1 : f.alphaBufferSize()); 69 70 } … … 75 76 if (f.sampleBuffers()) { 76 77 props.setValue(EGL_SAMPLE_BUFFERS, 1); 77 props.setValue(EGL_SAMPLES, f.samples() );78 props.setValue(EGL_SAMPLES, f.samples() == -1 ? 1 : f.samples()); 78 79 } else { 79 80 props.setValue(EGL_SAMPLE_BUFFERS, 0); … … 129 130 } 130 131 132 bool QGLFormat::hasOpenGL() 133 { 134 return true; 135 } 136 137 void QGLContext::reset() 138 { 139 Q_D(QGLContext); 140 if (!d->valid) 141 return; 142 d->cleanup(); 143 doneCurrent(); 144 if (d->eglContext) { 145 d->destroyEglSurfaceForDevice(); 146 delete d->eglContext; 147 } 148 d->eglContext = 0; 149 d->eglSurface = EGL_NO_SURFACE; 150 d->crWin = false; 151 d->sharing = false; 152 d->valid = false; 153 d->transpColor = QColor(); 154 d->initDone = false; 155 qgl_share_reg()->removeShare(this); 156 } 157 158 void QGLContext::makeCurrent() 159 { 160 Q_D(QGLContext); 161 if (!d->valid || !d->eglContext || d->eglSurface == EGL_NO_SURFACE) { 162 qWarning("QGLContext::makeCurrent(): Cannot make invalid context current"); 163 return; 164 } 165 166 if (d->eglContext->makeCurrent(d->eglSurface)) 167 QGLContextPrivate::setCurrentContext(this); 168 } 169 170 void QGLContext::doneCurrent() 171 { 172 Q_D(QGLContext); 173 if (d->eglContext) 174 d->eglContext->doneCurrent(); 175 176 QGLContextPrivate::setCurrentContext(0); 177 } 178 179 180 void QGLContext::swapBuffers() const 181 { 182 Q_D(const QGLContext); 183 if (!d->valid || !d->eglContext) 184 return; 185 186 d->eglContext->swapBuffers(d->eglSurface); 187 } 188 189 void QGLContextPrivate::destroyEglSurfaceForDevice() 190 { 191 if (eglSurface != EGL_NO_SURFACE) { 192 #ifdef Q_WS_X11 193 // Make sure we don't call eglDestroySurface on a surface which 194 // was created for a different winId: 195 if (paintDevice->devType() == QInternal::Widget) { 196 QGLWidget* w = static_cast<QGLWidget*>(paintDevice); 197 198 if (w->d_func()->eglSurfaceWindowId == w->winId()) 199 eglDestroySurface(eglContext->display(), eglSurface); 200 else 201 qWarning("WARNING: Potential EGL surface leak!"); 202 } else 203 #endif 204 eglDestroySurface(eglContext->display(), eglSurface); 205 eglSurface = EGL_NO_SURFACE; 206 } 207 } 208 209 void QGLWidget::setMouseTracking(bool enable) 210 { 211 QWidget::setMouseTracking(enable); 212 } 213 214 QColor QGLContext::overlayTransparentColor() const 215 { 216 return d_func()->transpColor; 217 } 218 219 uint QGLContext::colorIndex(const QColor &c) const 220 { 221 Q_UNUSED(c); 222 return 0; 223 } 224 225 void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) 226 { 227 Q_UNUSED(fnt); 228 Q_UNUSED(listBase); 229 } 230 231 void *QGLContext::getProcAddress(const QString &proc) const 232 { 233 return (void*)eglGetProcAddress(reinterpret_cast<const char *>(proc.toLatin1().data())); 234 } 235 236 bool QGLWidgetPrivate::renderCxPm(QPixmap*) 237 { 238 return false; 239 } 240 131 241 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.