src/gui/egl/qegl_wince.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
    85         qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
    85         qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
    86     }
    86     }
    87     return surf;
    87     return surf;
    88 }
    88 }
    89 
    89 
    90 EGLDisplay QEglContext::getDisplay(QPaintDevice *device)
    90 EGLNativeDisplayType QEglContext::nativeDisplay()
    91 {
    91 {
    92     EGLDisplay dpy = 0;
    92     HDC myDc = GetDC(0);
    93     HWND win = (static_cast<QWidget*>(device))->winId();
    93 
    94     HDC myDc = GetDC(win);
       
    95     if (!myDc) {
    94     if (!myDc) {
    96         qWarning("QEglContext::defaultDisplay(): WinCE display is not open");
    95         qWarning("QEglContext::nativeDisplay(): WinCE display is not open");
       
    96         return EGL_DEFAULT_DISPLAY;
    97     }
    97     }
    98     dpy = eglGetDisplay(EGLNativeDisplayType(myDc));
    98     return EGLNativeDisplayType(myDc);
    99     if (dpy == EGL_NO_DISPLAY) {
       
   100         qWarning("QEglContext::defaultDisplay(): Falling back to EGL_DEFAULT_DISPLAY");
       
   101         dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
       
   102     }
       
   103     return dpy;
       
   104 }
    99 }
   105 
   100 
   106 // Set pixel format and other properties based on a paint device.
   101 // Set pixel format and other properties based on a paint device.
   107 void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev)
   102 void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev)
   108 {
   103 {