Changeset 561 for trunk/src/opengl/qgl_win.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_win.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 ** … … 52 52 #include <qcolor.h> 53 53 54 #include < windows.h>54 #include <qt_windows.h> 55 55 56 56 typedef bool (APIENTRY *PFNWGLGETPIXELFORMATATTRIBIVARB)(HDC hdc, … … 643 643 if (parent && !parent->internalWinId()) 644 644 parent = parent->nativeParentWidget(); 645 QT_WA({ 646 const TCHAR *cname = (TCHAR*)windowClassName.utf16(); 647 dmy_id = CreateWindow(cname, 0, 0, 0, 0, 1, 1, 648 parent ? parent->winId() : 0, 0, qWinAppInst(), 0); 649 } , { 650 dmy_id = CreateWindowA(windowClassName.toLatin1(), 0, 0, 0, 0, 1, 1, 651 parent ? parent->winId() : 0, 0, qWinAppInst(), 0); 652 }); 645 646 dmy_id = CreateWindow((const wchar_t *)windowClassName.utf16(), 647 0, 0, 0, 0, 1, 1, 648 parent ? parent->winId() : 0, 0, qWinAppInst(), 0); 653 649 654 650 dmy_pdc = GetDC(dmy_id); … … 665 661 SetPixelFormat(dmy_pdc, dmy_pf, &dmy_pfd); 666 662 dmy_rc = wglCreateContext(dmy_pdc); 663 old_dc = wglGetCurrentDC(); 664 old_context = wglGetCurrentContext(); 667 665 wglMakeCurrent(dmy_pdc, dmy_rc); 668 666 } … … 673 671 ReleaseDC(dmy_id, dmy_pdc); 674 672 DestroyWindow(dmy_id); 673 if (old_dc && old_context) 674 wglMakeCurrent(old_dc, old_context); 675 675 } 676 676 677 677 HDC dmy_pdc; 678 678 HGLRC dmy_rc; 679 HDC old_dc; 680 HGLRC old_context; 679 681 WId dmy_id; 680 682 }; … … 885 887 } 886 888 887 /*! 888 \bold{Win32 only:} This virtual function chooses a pixel 889 format that matches the OpenGL \link setFormat() format\endlink. 890 Reimplement this function in a subclass if you need a custom 891 context. 892 893 \warning The \a dummyPfd pointer and \a pdc are used as a \c 894 PIXELFORMATDESCRIPTOR*. We use \c void to avoid using 895 Windows-specific types in our header files. 896 897 \sa chooseContext() 898 */ 899 889 /* 890 See qgl.cpp for qdoc comment. 891 */ 900 892 int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc) 901 893 { … … 1188 1180 1189 1181 if (wglMakeCurrent(d->dc, d->rc)) { 1190 if (!qgl_context_storage.hasLocalData() && QThread::currentThread()) 1191 qgl_context_storage.setLocalData(new QGLThreadContext); 1192 if (qgl_context_storage.hasLocalData()) 1193 qgl_context_storage.localData()->context = this; 1194 currentCtx = this; 1182 QGLContextPrivate::setCurrentContext(this); 1195 1183 } else { 1196 1184 qwglError("QGLContext::makeCurrent()", "wglMakeCurrent"); … … 1202 1190 { 1203 1191 Q_D(QGLContext); 1204 currentCtx = 0;1205 1192 wglMakeCurrent(0, 0); 1206 if (qgl_context_storage.hasLocalData()) 1207 qgl_context_storage.localData()->context = 0; 1193 QGLContextPrivate::setCurrentContext(0); 1208 1194 if (deviceIsPixmap() && d->hbitmap) { 1209 1195 QPixmap *pm = static_cast<QPixmap *>(d->paintDevice); … … 1428 1414 1429 1415 if (!d->glcx->isValid()) { 1430 bool wasSharing = shareContext || oldcx && oldcx->isSharing();1416 bool wasSharing = shareContext || (oldcx && oldcx->isSharing()); 1431 1417 d->glcx->create(shareContext ? shareContext : oldcx); 1432 1418 // the above is a trick to keep disp lists etc when a
Note:
See TracChangeset
for help on using the changeset viewer.