src/openvg/qwindowsurface_vg.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    46 #include "qvg_p.h"
    46 #include "qvg_p.h"
    47 
    47 
    48 #if !defined(QT_NO_EGL)
    48 #if !defined(QT_NO_EGL)
    49 
    49 
    50 #include <QtGui/private/qegl_p.h>
    50 #include <QtGui/private/qegl_p.h>
       
    51 #include <QtGui/private/qwidget_p.h>
    51 
    52 
    52 QT_BEGIN_NAMESPACE
    53 QT_BEGIN_NAMESPACE
    53 
    54 
    54 QVGWindowSurface::QVGWindowSurface(QWidget *window)
    55 QVGWindowSurface::QVGWindowSurface(QWidget *window)
    55     : QWindowSurface(window)
    56     : QWindowSurface(window)
    56 {
    57 {
    57     d_ptr = QVGEGLWindowSurfacePrivate::create
    58     // Create the default type of EGL window surface for windows.
    58         (QVGEGLWindowSurfacePrivate::WindowSurface, this);
    59     d_ptr = new QVGEGLWindowSurfaceDirect(this);
    59 }
    60 }
    60 
    61 
    61 QVGWindowSurface::QVGWindowSurface
    62 QVGWindowSurface::QVGWindowSurface
    62         (QWidget *window, QVGEGLWindowSurfacePrivate *d)
    63         (QWidget *window, QVGEGLWindowSurfacePrivate *d)
    63     : QWindowSurface(window), d_ptr(d)
    64     : QWindowSurface(window), d_ptr(d)
    69     delete d_ptr;
    70     delete d_ptr;
    70 }
    71 }
    71 
    72 
    72 QPaintDevice *QVGWindowSurface::paintDevice()
    73 QPaintDevice *QVGWindowSurface::paintDevice()
    73 {
    74 {
    74     d_ptr->beginPaint(window());
       
    75     return this;
    75     return this;
    76 }
    76 }
    77 
    77 
    78 void QVGWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
    78 void QVGWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
    79 {
    79 {
    92     return QWindowSurface::scroll(area, dx, dy);
    92     return QWindowSurface::scroll(area, dx, dy);
    93 }
    93 }
    94 
    94 
    95 void QVGWindowSurface::beginPaint(const QRegion &region)
    95 void QVGWindowSurface::beginPaint(const QRegion &region)
    96 {
    96 {
    97     // Nothing to do here.
    97     d_ptr->beginPaint(window());
    98     Q_UNUSED(region);
    98 
       
    99     // If the window is not opaque, then fill the region we are about
       
   100     // to paint with the transparent color.
       
   101     if (!qt_widget_private(window())->isOpaque &&
       
   102             window()->testAttribute(Qt::WA_TranslucentBackground)) {
       
   103         QVGPaintEngine *engine = static_cast<QVGPaintEngine *>
       
   104             (d_ptr->paintEngine());
       
   105         engine->fillRegion(region, Qt::transparent, d_ptr->surfaceSize());
       
   106     }
    99 }
   107 }
   100 
   108 
   101 void QVGWindowSurface::endPaint(const QRegion &region)
   109 void QVGWindowSurface::endPaint(const QRegion &region)
   102 {
   110 {
   103     // Nothing to do here.
   111     // Nothing to do here.