Make translucent windows working properly with OpenVG.
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Wed, 27 Apr 2011 13:18:58 +0000 (15:18 +0200)
committerOlivier Goffart <olivier.goffart@nokia.com>
Tue, 10 May 2011 10:54:50 +0000 (12:54 +0200)
The OpenVG engine correctly uses vgClear() to fill the surface with
transparent pixels whenever the window has the WA_TranslucentBackground
attribute enabled. However both scissoring and masking affects
the operation of vgClear(). Drawing artifacts were previously
visible due this, simply because scissoring was left enabled by
the VG paint engine, and the filling with transparent pixels
happens in the window surface's beginPaint() that is called
between the paint engine's end() (for the previous paint) and
begin() (for the next paint).

Task-number: QT-4907
Reviewed-by: Jani Hautakangas
(cherry picked from commit 4a1ae3d1b4e8e032b1c978fcc7e1812e37e1f047)

src/openvg/qpaintengine_vg.cpp

index 1f42e02..68a6a0b 100644 (file)
@@ -1558,6 +1558,8 @@ bool QVGPaintEngine::begin(QPaintDevice *pdev)
 
 bool QVGPaintEngine::end()
 {
+    vgSeti(VG_SCISSORING, VG_FALSE);
+    vgSeti(VG_MASKING, VG_FALSE);
     return true;
 }
 
@@ -3867,6 +3869,8 @@ void QVGPaintEngine::beginNativePainting()
 #if !defined(QVG_NO_DRAW_GLYPHS)
     d->setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, d->pathTransform);
 #endif
+    vgSeti(VG_SCISSORING, VG_FALSE);
+    vgSeti(VG_MASKING, VG_FALSE);
     d->rawVG = true;
 }
 
@@ -3927,6 +3931,7 @@ void QVGPaintEngine::restoreState(QPaintEngine::DirtyFlags dirty)
     if ((dirty & QPaintEngine::DirtyBrushOrigin) != 0)
         brushOriginChanged();
     d->fillRule = 0;
+    d->clearColor = QColor();
     if ((dirty & QPaintEngine::DirtyOpacity) != 0)
         opacityChanged();
     if ((dirty & QPaintEngine::DirtyTransform) != 0)