summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-18 15:04:46 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-06-18 15:07:04 (GMT)
commitf9f08de9d41fd55d9c7d01578191ef5d4099c9e6 (patch)
treee6167fa1475a201c887f46f3b0c411f3e92d645a /src/gui/painting
parent396eeb3f71c1c7edd861da1c8a8ec3086348502e (diff)
downloadQt-f9f08de9d41fd55d9c7d01578191ef5d4099c9e6.zip
Qt-f9f08de9d41fd55d9c7d01578191ef5d4099c9e6.tar.gz
Qt-f9f08de9d41fd55d9c7d01578191ef5d4099c9e6.tar.bz2
Use QTransform more efficiently.
Reviewed-by: Samuel
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qpaintengine.cpp3
-rw-r--r--src/gui/painting/qpaintengineex.cpp3
-rw-r--r--src/gui/painting/qpdf.cpp3
-rw-r--r--src/gui/painting/qprintengine_win.cpp6
4 files changed, 5 insertions, 10 deletions
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index 8e8485d..4fb1832 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -1008,8 +1008,7 @@ void QPaintEnginePrivate::drawBoxTextItem(const QPointF &p, const QTextItemInt &
const int size = qRound(ti.fontEngine->ascent());
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
- QTransform matrix;
- matrix.translate(p.x(), p.y() - size);
+ QTransform matrix = QTransform::fromTranslate(p.x(), p.y() - size);
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
if (glyphs.size() == 0)
return;
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 5ebca47..a4db284 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -848,8 +848,7 @@ void QPaintEngineEx::drawImage(const QPointF &pos, const QImage &image)
void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
{
QBrush brush(state()->pen.color(), pixmap);
- QTransform xform;
- xform.translate(r.x() - s.x(), r.y() - s.y());
+ QTransform xform = QTransform::fromTranslate(r.x() - s.x(), r.y() - s.y());
brush.setTransform(xform);
qreal pts[] = { r.x(), r.y(),
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index c3452e1..664751a 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1929,8 +1929,7 @@ void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &t
QVarLengthArray<glyph_t> glyphs;
QVarLengthArray<QFixedPoint> positions;
- QTransform m;
- m.translate(p.x(), p.y());
+ QTransform m = QTransform::fromTranslate(p.x(), p.y());
ti.fontEngine->getGlyphPositions(ti.glyphs, m, ti.flags,
glyphs, positions);
if (glyphs.size() == 0)
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index 179927f..72faf7c 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -663,8 +663,7 @@ void QWin32PrintEngine::drawPixmap(const QRectF &targetRect,
qreal scaleX = 1.0f;
qreal scaleY = 1.0f;
- QTransform scaleMatrix;
- scaleMatrix.scale(r.width() / pixmap.width(), r.height() / pixmap.height());
+ QTransform scaleMatrix = QTransform::fromScale(r.width() / pixmap.width(), r.height() / pixmap.height());
QTransform adapted = QPixmap::trueMatrix(d->painterMatrix * scaleMatrix,
pixmap.width(), pixmap.height());
@@ -1875,8 +1874,7 @@ static void draw_text_item_win(const QPointF &_pos, const QTextItemInt &ti, HDC
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> _glyphs;
- QTransform matrix;
- matrix.translate(baseline_pos.x(), baseline_pos.y());
+ QTransform matrix = QTransform::fromTranslate(baseline_pos.x(), baseline_pos.y());
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags,
_glyphs, positions);
if (_glyphs.size() == 0) {