diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2010-03-17 13:28:50 (GMT) |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2010-03-17 13:33:34 (GMT) |
commit | 6aba7215a0ac2092a7f00015df0d7a80681ef6bc (patch) | |
tree | ba486c3999713bbe73d3acb78a7ec117cdfe124f /src | |
parent | c950a2594f7c3102930541800edac5384827846d (diff) | |
download | Qt-6aba7215a0ac2092a7f00015df0d7a80681ef6bc.zip Qt-6aba7215a0ac2092a7f00015df0d7a80681ef6bc.tar.gz Qt-6aba7215a0ac2092a7f00015df0d7a80681ef6bc.tar.bz2 |
Fixes blending problem when paiting non-opaque items with cache enabled.
In most cases when partially updating an item, the old content of the
cache needs to be replaced with the new content
(CompositionMode_Source). But in a specific case when using
DeviceCoordinateCache and when the item is transformed, the new content
needs to be blended (CompositionMode_SourceAtop) with the old one to
avoid incorrect fully transparent background.
Autotest included.
Task-number: QTBUG-7863
Reviewed-by: bnilsen
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 4ee2301..6934abc 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4285,6 +4285,12 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion & if (!subPix.isNull()) { // Blit the subpixmap into the main pixmap. pixmapPainter.begin(pix); + if (item->cacheMode() == QGraphicsItem::DeviceCoordinateCache + && itemToPixmap.type() > QTransform::TxTranslate) { + pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceAtop); + } else { + pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source); + } pixmapPainter.setClipRegion(pixmapExposed); pixmapPainter.drawPixmap(br.topLeft(), subPix); pixmapPainter.end(); |