src/opengl/qgl_wince.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 33 3e2da88830cd
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    52 #include <qapplication.h>
    52 #include <qapplication.h>
    53 #include <qdesktopwidget>
    53 #include <qdesktopwidget>
    54 
    54 
    55 #include <windows.h>
    55 #include <windows.h>
    56 
    56 
    57 #include <private/qegl_p.h>
    57 #include <private/qeglproperties_p.h>
       
    58 #include <private/qeglcontext_p.h>
    58 #include <private/qgl_egl_p.h>
    59 #include <private/qgl_egl_p.h>
    59 #include <private/qgl_cl_p.h>
    60 #include <private/qgl_cl_p.h>
    60 
    61 
    61 
    62 
    62 QT_BEGIN_NAMESPACE
    63 QT_BEGIN_NAMESPACE
   118 }
   119 }
   119 
   120 
   120 /*****************************************************************************
   121 /*****************************************************************************
   121   QGLFormat Win32/WGL-specific code
   122   QGLFormat Win32/WGL-specific code
   122  *****************************************************************************/
   123  *****************************************************************************/
   123 
       
   124 void qt_egl_add_platform_config(QEglProperties& props, QPaintDevice *device)
       
   125 {
       
   126     int devType = device->devType();
       
   127     if (devType == QInternal::Image)
       
   128         props.setPixelFormat(static_cast<QImage *>(device)->format());
       
   129     else
       
   130         props.setPixelFormat(QImage::Format_RGB16);
       
   131 }
       
   132 
       
   133 
   124 
   134 static bool opengl32dll = false;
   125 static bool opengl32dll = false;
   135 
   126 
   136 bool QGLFormat::hasOpenGLOverlays()
   127 bool QGLFormat::hasOpenGLOverlays()
   137 {
   128 {
   152         return false;
   143         return false;
   153     }
   144     }
   154 
   145 
   155     // Get the display and initialize it.
   146     // Get the display and initialize it.
   156     d->eglContext = new QEglContext();
   147     d->eglContext = new QEglContext();
       
   148     d->ownsEglContext = true;
   157     d->eglContext->setApi(QEgl::OpenGL);
   149     d->eglContext->setApi(QEgl::OpenGL);
   158 
   150 
   159     // Construct the configuration we need for this surface.
   151     // Construct the configuration we need for this surface.
   160     QEglProperties configProps;
   152     QEglProperties configProps;
   161     qt_egl_add_platform_config(configProps, device());
   153     qt_eglproperties_set_glformat(configProps, d->glFormat);
   162     qt_egl_set_format(configProps, devType, d->glFormat);
   154     configProps.setDeviceType(devType);
       
   155     configProps.setPaintDeviceFormat(device());
   163     configProps.setRenderableType(QEgl::OpenGL);
   156     configProps.setRenderableType(QEgl::OpenGL);
   164 
   157 
   165     // Search for a matching configuration, reducing the complexity
   158     // Search for a matching configuration, reducing the complexity
   166     // each time until we get something that matches.
   159     // each time until we get something that matches.
   167     if (!d->eglContext->chooseConfig(configProps)) {
   160     if (!d->eglContext->chooseConfig(configProps)) {
   169         d->eglContext = 0;
   162         d->eglContext = 0;
   170         return false;
   163         return false;
   171     }
   164     }
   172 
   165 
   173     // Inform the higher layers about the actual format properties.
   166     // Inform the higher layers about the actual format properties.
   174     qt_egl_update_format(*(d->eglContext), d->glFormat);
   167     qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config());
   175 
   168 
   176     // Create a new context for the configuration.
   169     // Create a new context for the configuration.
   177     if (!d->eglContext->createContext
   170     if (!d->eglContext->createContext
   178             (shareContext ? shareContext->d_func()->eglContext : 0)) {
   171             (shareContext ? shareContext->d_func()->eglContext : 0)) {
   179         delete d->eglContext;
   172         delete d->eglContext;