summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-10-27 05:32:19 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-10-27 05:32:19 (GMT)
commitf06d7a128bf6b231fde521f7008db48138783731 (patch)
tree028874ab1e2d9d7f5a1d178ffa051efc23c7c139 /src/openvg
parent55ee937db840b69d100905b08d8f645fe79f9571 (diff)
downloadQt-f06d7a128bf6b231fde521f7008db48138783731.zip
Qt-f06d7a128bf6b231fde521f7008db48138783731.tar.gz
Qt-f06d7a128bf6b231fde521f7008db48138783731.tar.bz2
Use vgClear() to clear the background during screen compositing.
This fixes an "off by 1" bug in screen compositing with OpenVG that left lines all over the background when windows were moved. Task-number: QT-2322 Reviewed-by: Sarah Smith
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qpaintengine_vg.cpp64
1 files changed, 46 insertions, 18 deletions
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index da07c1d..f8dd8a5 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -3527,27 +3527,55 @@ static void fillBackgroundRect(const QRect& rect, QVGPaintEnginePrivate *d)
void QVGCompositionHelper::fillBackground
(const QRegion& region, const QBrush& brush)
{
- // Set the path transform to the default viewport transformation.
- VGfloat devh = screenSize.height() - 1;
- QTransform viewport(1.0f, 0.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.5f, devh + 0.5f, 1.0f);
- d->setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, viewport);
-
- // Set the brush to use to fill the background.
- d->ensureBrush(brush);
- d->setFillRule(VG_EVEN_ODD);
+ if (brush.style() == Qt::SolidPattern) {
+ // Use vgClear() to quickly fill the background.
+ QColor color = brush.color();
+ if (d->clearColor != color || d->clearOpacity != 1.0f) {
+ VGfloat values[4];
+ values[0] = color.redF();
+ values[1] = color.greenF();
+ values[2] = color.blueF();
+ values[3] = color.alphaF();
+ vgSetfv(VG_CLEAR_COLOR, 4, values);
+ d->clearColor = color;
+ d->clearOpacity = 1.0f;
+ }
+ if (region.numRects() == 1) {
+ QRect r = region.boundingRect();
+ vgClear(r.x(), screenSize.height() - r.y() - r.height(),
+ r.width(), r.height());
+ } else {
+ const QVector<QRect> rects = region.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ QRect r = rects.at(i);
+ vgClear(r.x(), screenSize.height() - r.y() - r.height(),
+ r.width(), r.height());
+ }
+ }
- if (region.numRects() == 1) {
- fillBackgroundRect(region.boundingRect(), d);
} else {
- const QVector<QRect> rects = region.rects();
- for (int i = 0; i < rects.size(); ++i)
- fillBackgroundRect(rects.at(i), d);
- }
+ // Set the path transform to the default viewport transformation.
+ VGfloat devh = screenSize.height() - 1;
+ QTransform viewport(1.0f, 0.0f, 0.0f,
+ 0.0f, -1.0f, 0.0f,
+ 0.5f, devh + 0.5f, 1.0f);
+ d->setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, viewport);
+
+ // Set the brush to use to fill the background.
+ d->ensureBrush(brush);
+ d->setFillRule(VG_EVEN_ODD);
+
+ if (region.numRects() == 1) {
+ fillBackgroundRect(region.boundingRect(), d);
+ } else {
+ const QVector<QRect> rects = region.rects();
+ for (int i = 0; i < rects.size(); ++i)
+ fillBackgroundRect(rects.at(i), d);
+ }
- // We will need to reset the path transform during the next paint.
- d->pathTransformSet = false;
+ // We will need to reset the path transform during the next paint.
+ d->pathTransformSet = false;
+ }
}
void QVGCompositionHelper::drawCursorImage