summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-05-12 08:21:21 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-05-12 08:44:01 (GMT)
commitbb0e2a55192cd134eb642dfa2f5e7ee93668a059 (patch)
tree8059791bcbab53acba9dec69989f0774fb81efef /src/gui
parent8d94fcce0a2ca382eac8357dae05ad387551e364 (diff)
downloadQt-bb0e2a55192cd134eb642dfa2f5e7ee93668a059.zip
Qt-bb0e2a55192cd134eb642dfa2f5e7ee93668a059.tar.gz
Qt-bb0e2a55192cd134eb642dfa2f5e7ee93668a059.tar.bz2
Fix handling of gradients on pens in the emulation paint engine.
The handling of gradients with object bounding mode on pens in the emulation paint engine has been changed to agree with the SVG standard, where pen widths are ignored when calculating bounding boxes. Instead of converting strokes to fills and then transforming the gradients based on the fills' bounding box, the gradients are now transformed first based on the bounding box of the stroke path. Reviewed-by: Trond
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 3397c45..175f1ab 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -123,14 +123,30 @@ void QEmulationPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
real_engine->stroke(path, bgPen);
}
-
QBrush brush = pen.brush();
+ QPen copy = pen;
Qt::BrushStyle style = qbrush_style(brush);
if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
const QGradient *g = brush.gradient();
+
if (g->coordinateMode() > QGradient::LogicalMode) {
- QPaintEngineEx::stroke(path, pen);
- return;
+ if (g->coordinateMode() == QGradient::StretchToDeviceMode) {
+ QTransform mat = brush.transform();
+ mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height());
+ brush.setTransform(mat);
+ copy.setBrush(brush);
+ real_engine->stroke(path, copy);
+ return;
+ } else if (g->coordinateMode() == QGradient::ObjectBoundingMode) {
+ QTransform mat = brush.transform();
+ QRealRect r = path.controlPointRect();
+ mat.translate(r.x1, r.y1);
+ mat.scale(r.x2 - r.x1, r.y2 - r.y1);
+ brush.setTransform(mat);
+ copy.setBrush(brush);
+ real_engine->stroke(path, copy);
+ return;
+ }
}
}