summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-12-21 13:23:21 (GMT)
committerIikka Eklund <iikka.eklund@digia.com>2011-05-23 11:20:47 (GMT)
commitd1c5883d2d0fe580ae7a55ce74df1957c41cfbf4 (patch)
treec9e72bd2d1428c3eba626dc53de0aa89399dcabf /src
parent76353f177cd84327c692ea31ec644df683643194 (diff)
downloadQt-d1c5883d2d0fe580ae7a55ce74df1957c41cfbf4.zip
Qt-d1c5883d2d0fe580ae7a55ce74df1957c41cfbf4.tar.gz
Qt-d1c5883d2d0fe580ae7a55ce74df1957c41cfbf4.tar.bz2
Fixed gradients on text when coordinate mode != logical mode.
Task-number: QTBUG-6395 Reviewed-by: Samuel (cherry picked from commit 22573ddffc28135fba2dbb9eb2d50a76cae0a09c)
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index f9c4216..b6d02c6 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -172,6 +172,36 @@ void QEmulationPaintEngine::drawTextItem(const QPointF &p, const QTextItem &text
QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal());
fillBGRect(rect);
}
+
+ QPainterState *s = state();
+ Qt::BrushStyle style = qbrush_style(s->pen.brush());
+ if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern)
+ {
+ QPen savedPen = s->pen;
+ QGradient g = *s->pen.brush().gradient();
+
+ if (g.coordinateMode() > QGradient::LogicalMode) {
+ QTransform mat = s->pen.brush().transform();
+ if (g.coordinateMode() == QGradient::StretchToDeviceMode) {
+ mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height());
+ } else if (g.coordinateMode() == QGradient::ObjectBoundingMode) {
+ const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
+ QRectF r(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal());
+ mat.translate(r.x(), r.y());
+ mat.scale(r.width(), r.height());
+ }
+ g.setCoordinateMode(QGradient::LogicalMode);
+ QBrush brush(g);
+ brush.setTransform(mat);
+ s->pen.setBrush(brush);
+ penChanged();
+ real_engine->drawTextItem(p, textItem);
+ s->pen = savedPen;
+ penChanged();
+ return;
+ }
+ }
+
real_engine->drawTextItem(p, textItem);
}