src/opengl/qgraphicssystem_gl.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    38 ** $QT_END_LICENSE$
    38 ** $QT_END_LICENSE$
    39 **
    39 **
    40 ****************************************************************************/
    40 ****************************************************************************/
    41 
    41 
    42 #include "qgraphicssystem_gl_p.h"
    42 #include "qgraphicssystem_gl_p.h"
       
    43 #include <QGraphicsView>
    43 
    44 
    44 #include "private/qpixmap_raster_p.h"
    45 #include "private/qpixmap_raster_p.h"
    45 #include "private/qpixmapdata_gl_p.h"
    46 #include "private/qpixmapdata_gl_p.h"
    46 #include "private/qwindowsurface_gl_p.h"
    47 #include "private/qwindowsurface_gl_p.h"
    47 #include "private/qgl_p.h"
    48 #include "private/qgl_p.h"
    48 #include <private/qwindowsurface_raster_p.h>
    49 #include <private/qwindowsurface_raster_p.h>
    49 
    50 
    50 #if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
    51 #if defined(Q_WS_X11) && !defined(QT_NO_EGL)
    51 #include "private/qpixmapdata_x11gl_p.h"
    52 #include "private/qpixmapdata_x11gl_p.h"
    52 #include "private/qwindowsurface_x11gl_p.h"
    53 #include "private/qwindowsurface_x11gl_p.h"
    53 #endif
    54 #endif
    54 
    55 
    55 QT_BEGIN_NAMESPACE
    56 QT_BEGIN_NAMESPACE
    56 
    57 
    57 extern QGLWidget *qt_gl_getShareWidget();
    58 extern QGLWidget *qt_gl_getShareWidget();
    58 
    59 
    59 QPixmapData *QGLGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
    60 QPixmapData *QGLGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
    60 {
    61 {
    61 #if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
       
    62     if (type == QPixmapData::PixmapType && QX11GLPixmapData::hasX11GLPixmaps())
       
    63         return new QX11GLPixmapData();
       
    64 #endif
       
    65 
       
    66     return new QGLPixmapData(type);
    62     return new QGLPixmapData(type);
    67 }
    63 }
    68 
    64 
    69 QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const
    65 QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const
    70 {
    66 {
    74     // top level window opacity.
    70     // top level window opacity.
    75     if (widget->windowType() == Qt::Popup)
    71     if (widget->windowType() == Qt::Popup)
    76         return new QRasterWindowSurface(widget);
    72         return new QRasterWindowSurface(widget);
    77 #endif
    73 #endif
    78 
    74 
    79 #if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
    75 #if defined(Q_WS_X11) && !defined(QT_NO_EGL)
    80     if (QX11GLPixmapData::hasX11GLPixmaps())
    76     if (m_useX11GL && QX11GLPixmapData::hasX11GLPixmaps()) {
    81         return new QX11GLWindowSurface(widget);
    77         // If the widget is a QGraphicsView which will be re-drawing the entire
       
    78         // scene each frame anyway, we should use QGLWindowSurface as this may
       
    79         // provide proper buffer flipping, which should be faster than QX11GL's
       
    80         // blitting approach:
       
    81         QGraphicsView* qgv = qobject_cast<QGraphicsView*>(widget);
       
    82         if (qgv && qgv->viewportUpdateMode() == QGraphicsView::FullViewportUpdate)
       
    83             return new QGLWindowSurface(widget);
       
    84         else
       
    85             return new QX11GLWindowSurface(widget);
       
    86     }
    82 #endif
    87 #endif
    83 
    88 
    84     return new QGLWindowSurface(widget);
    89     return new QGLWindowSurface(widget);
    85 }
    90 }
    86 
    91