Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/opengl/qgl_win.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the QtOpenGL module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
     
    5252#include <qcolor.h>
    5353
    54 #include <windows.h>
     54#include <qt_windows.h>
    5555
    5656typedef bool (APIENTRY *PFNWGLGETPIXELFORMATATTRIBIVARB)(HDC hdc,
     
    643643        if (parent && !parent->internalWinId())
    644644            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);
    653649
    654650        dmy_pdc = GetDC(dmy_id);
     
    665661        SetPixelFormat(dmy_pdc, dmy_pf, &dmy_pfd);
    666662        dmy_rc = wglCreateContext(dmy_pdc);
     663        old_dc = wglGetCurrentDC();
     664        old_context = wglGetCurrentContext();
    667665        wglMakeCurrent(dmy_pdc, dmy_rc);
    668666    }
     
    673671        ReleaseDC(dmy_id, dmy_pdc);
    674672        DestroyWindow(dmy_id);
     673        if (old_dc && old_context)
     674            wglMakeCurrent(old_dc, old_context);
    675675    }
    676676
    677677    HDC dmy_pdc;
    678678    HGLRC dmy_rc;
     679    HDC old_dc;
     680    HGLRC old_context;
    679681    WId dmy_id;
    680682};
     
    885887}
    886888
    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 */
    900892int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc)
    901893{
     
    11881180
    11891181    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);
    11951183    } else {
    11961184        qwglError("QGLContext::makeCurrent()", "wglMakeCurrent");
     
    12021190{
    12031191    Q_D(QGLContext);
    1204     currentCtx = 0;
    12051192    wglMakeCurrent(0, 0);
    1206     if (qgl_context_storage.hasLocalData())
    1207         qgl_context_storage.localData()->context = 0;
     1193    QGLContextPrivate::setCurrentContext(0);
    12081194    if (deviceIsPixmap() && d->hbitmap) {
    12091195        QPixmap *pm = static_cast<QPixmap *>(d->paintDevice);
     
    14281414
    14291415    if (!d->glcx->isValid()) {
    1430         bool wasSharing = shareContext || oldcx && oldcx->isSharing();
     1416        bool wasSharing = shareContext || (oldcx && oldcx->isSharing());
    14311417        d->glcx->create(shareContext ? shareContext : oldcx);
    14321418        // the above is a trick to keep disp lists etc when a
Note: See TracChangeset for help on using the changeset viewer.