diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-05-12 10:21:21 +0200 |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-05-12 10:44:01 +0200 |
commit | bb0e2a55192cd134eb642dfa2f5e7ee93668a059 (patch) | |
tree | 8059791bcbab53acba9dec69989f0774fb81efef /src | |
parent | 8d94fcce0a2ca382eac8357dae05ad387551e364 (diff) | |
download | qt4-tools-bb0e2a55192cd134eb642dfa2f5e7ee93668a059.tar.gz |
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')
-rw-r--r-- | src/gui/painting/qemulationpaintengine.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp index 3397c45608..175f1ab7a5 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; + } } } |