summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-11-03 11:15:53 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2009-11-03 11:17:24 (GMT)
commit68be6457f6732437b485812ab2db11c147a24b51 (patch)
tree62ff5c58fd075ae9c09cbf178dd5950fdb293c5b
parent1fd46b4495241ed03371fb5c86965b788791b363 (diff)
downloadQt-68be6457f6732437b485812ab2db11c147a24b51.zip
Qt-68be6457f6732437b485812ab2db11c147a24b51.tar.gz
Qt-68be6457f6732437b485812ab2db11c147a24b51.tar.bz2
Removed usage of CompositionMode_Source in QGraphicsView for X11.
Due to the rendering model in XRender ((src IN mask) OP dest) we can't support the PorterDuff composition modes natively under X11. They just behave differently than what we've defined them to do in QPainter, and there is no apparent workaround. Task-number: QTBUG-4829 Reviewed-by: Gunnar
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp8
-rw-r--r--src/gui/painting/qpainter.cpp5
2 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 710c745..8945f51 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -281,6 +281,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
#include <QtGui/qstyleoption.h>
#include <QtGui/qinputcontext.h>
#ifdef Q_WS_X11
+#include <QtGui/qpaintengine.h>
#include <private/qt_x11_p.h>
#endif
@@ -3294,7 +3295,12 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
backgroundPainter.setClipRegion(d->backgroundPixmapExposed, Qt::ReplaceClip);
if (viewTransformed)
backgroundPainter.setTransform(viewTransform);
- backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source);
+#ifdef Q_WS_X11
+#undef X11
+ if (backgroundPainter.paintEngine()->type() != QPaintEngine::X11)
+#define X11 qt_x11Data
+#endif
+ backgroundPainter.setCompositionMode(QPainter::CompositionMode_Source);
drawBackground(&backgroundPainter, exposedSceneRect);
d->backgroundPixmapExposed = QRegion();
}
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index cddad7d..8d6cad3 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -2275,8 +2275,9 @@ void QPainter::setBrushOrigin(const QPointF &p)
/*!
Sets the composition mode to the given \a mode.
- \warning You can only set the composition mode for QPainter
- objects that operates on a QImage.
+ \warning Only a QPainter operating on a QImage fully supports all
+ composition modes. The RasterOp modes are supported for X11 as
+ described in compositionMode().
\sa compositionMode()
*/