From c327fb79e1a50c825a945e97f2c66d07a1c6d225 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 12 Apr 2016 10:12:09 +0200 Subject: Use QTransform instead of doing transforms manually Minor cleanup of QOutlineMapper to take advantage of QTransform. Change-Id: I15534970a821c7f1de42f4a5a2560f04ae420d16 Reviewed-by: Gunnar Sletta --- src/gui/painting/qoutlinemapper.cpp | 44 +++++-------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) (limited to 'src/gui/painting/qoutlinemapper.cpp') diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index 9eb6ee93f2..0d10fa18bb 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -38,9 +38,10 @@ ****************************************************************************/ #include "qoutlinemapper_p.h" -#include + +#include "qbezier_p.h" #include "qmath.h" -#include +#include "qpainterpath_p.h" #include @@ -187,39 +188,9 @@ void QOutlineMapper::endOutline() QPointF *elements = m_elements.data(); // Transform the outline - if (m_txop == QTransform::TxNone) { - // Nothing to do. - } else if (m_txop == QTransform::TxTranslate) { - for (int i = 0; i < m_elements.size(); ++i) { - QPointF &e = elements[i]; - e = QPointF(e.x() + m_dx, e.y() + m_dy); - } - } else if (m_txop == QTransform::TxScale) { - for (int i = 0; i < m_elements.size(); ++i) { - QPointF &e = elements[i]; - e = QPointF(m_m11 * e.x() + m_dx, m_m22 * e.y() + m_dy); - } - } else if (m_txop < QTransform::TxProject) { - for (int i = 0; i < m_elements.size(); ++i) { - QPointF &e = elements[i]; - e = QPointF(m_m11 * e.x() + m_m21 * e.y() + m_dx, - m_m22 * e.y() + m_m12 * e.x() + m_dy); - } - } else { - const QVectorPath vp((qreal *)elements, m_elements.size(), - m_element_types.size() ? m_element_types.data() : 0); - QPainterPath path = vp.convertToPainterPath(); - path = QTransform(m_m11, m_m12, m_m13, m_m21, m_m22, m_m23, m_dx, m_dy, m_m33).map(path); - if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL)) - path.setFillRule(Qt::WindingFill); - uint old_txop = m_txop; - m_txop = QTransform::TxNone; - if (path.isEmpty()) - m_valid = false; - else - convertPath(path); - m_txop = old_txop; - return; + if (!m_in_clip_elements) { + for (int i = 0; i < m_elements.size(); ++i) + elements[i] = m_transform.map(elements[i]); } controlPointRect = boundingRect(elements, m_elements.size()); @@ -387,13 +358,10 @@ void QOutlineMapper::clipElements(const QPointF *elements, QPainterPath clipPath; clipPath.addRect(m_clip_rect); QPainterPath clippedPath = path.intersected(clipPath); - uint old_txop = m_txop; - m_txop = QTransform::TxNone; if (clippedPath.isEmpty()) m_valid = false; else convertPath(clippedPath); - m_txop = old_txop; m_in_clip_elements = false; } -- cgit v1.2.3