summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-04-12 10:12:09 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-04-12 19:24:52 +0000
commitc327fb79e1a50c825a945e97f2c66d07a1c6d225 (patch)
tree78b6bc055b9699bbadd3c9debc1106511e99a3a0
parent0a1c8cc6686cb80cb5c35509c9eaa1fe9e27c495 (diff)
Use QTransform instead of doing transforms manuallyv5.7.0-beta1
Minor cleanup of QOutlineMapper to take advantage of QTransform. Change-Id: I15534970a821c7f1de42f4a5a2560f04ae420d16 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
-rw-r--r--src/gui/painting/qoutlinemapper.cpp44
-rw-r--r--src/gui/painting/qoutlinemapper_p.h23
2 files changed, 8 insertions, 59 deletions
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 <private/qpainterpath_p.h>
+
+#include "qbezier_p.h"
#include "qmath.h"
-#include <private/qbezier_p.h>
+#include "qpainterpath_p.h"
#include <stdlib.h>
@@ -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;
}
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index 05b2fd14ec..47413d920c 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -104,16 +104,7 @@ public:
*/
void setMatrix(const QTransform &m)
{
- m_m11 = m.m11();
- m_m12 = m.m12();
- m_m13 = m.m13();
- m_m21 = m.m21();
- m_m22 = m.m22();
- m_m23 = m.m23();
- m_m33 = m.m33();
- m_dx = m.dx();
- m_dy = m.dy();
- m_txop = m.type();
+ m_transform = m;
qreal scale;
qt_scaleForTransform(m, &scale);
@@ -207,20 +198,10 @@ public:
QRectF controlPointRect; // only valid after endOutline()
QT_FT_Outline m_outline;
- uint m_txop;
int m_subpath_start;
- // Matrix
- qreal m_m11;
- qreal m_m12;
- qreal m_m13;
- qreal m_m21;
- qreal m_m22;
- qreal m_m23;
- qreal m_m33;
- qreal m_dx;
- qreal m_dy;
+ QTransform m_transform;
qreal m_curve_threshold;