summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qoutlinemapper_p.h
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2011-12-12 12:57:08 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-16 00:51:47 +0100
commit6506e0a6eec67985432427c630b148e825184c5d (patch)
tree1216f1ef8fe485fd6f5d0fa306a0cb29d1e4d2b5 /src/gui/painting/qoutlinemapper_p.h
parent7b874b7fc4c56a039eaab7f8828379637fff8212 (diff)
Improved path filling performance in the raster paint engine.
Convert bezier curves to polylines before rasterizing with gray raster. Change-Id: I353debd4338f2a3ce2fa1cfa1bff9dd2e36f05ab Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/gui/painting/qoutlinemapper_p.h')
-rw-r--r--src/gui/painting/qoutlinemapper_p.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index 388858ca44..7bcf3166ca 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -73,6 +73,8 @@ const int QT_RASTER_COORD_LIMIT = 32767;
//#define QT_DEBUG_CONVERT
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
+
/********************************************************************************
* class QOutlineMapper
*
@@ -90,11 +92,9 @@ public:
QOutlineMapper() :
m_element_types(0),
m_elements(0),
- m_elements_dev(0),
m_points(0),
m_tags(0),
m_contours(0),
- m_polygon_dev(0),
m_in_clip_elements(false),
m_round_coords(false)
{
@@ -117,6 +117,10 @@ public:
m_dx = m.dx();
m_dy = m.dy();
m_txop = m.type();
+
+ qreal scale;
+ qt_scaleForTransform(m, &scale);
+ m_curve_threshold = scale == 0 ? qreal(0.25) : (qreal(0.25) / scale);
}
void beginOutline(Qt::FillRule fillRule)
@@ -126,7 +130,6 @@ public:
#endif
m_valid = true;
m_elements.reset();
- m_elements_dev.reset();
m_element_types.reset();
m_points.reset();
m_tags.reset();
@@ -161,15 +164,7 @@ public:
m_element_types << QPainterPath::LineToElement;
}
- inline void curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep) {
-#ifdef QT_DEBUG_CONVERT
- printf("QOutlineMapper::curveTo() (%f, %f)\n", ep.x(), ep.y());
-#endif
- m_elements << cp1 << cp2 << ep;
- m_element_types << QPainterPath::CurveToElement
- << QPainterPath::CurveToDataElement
- << QPainterPath::CurveToDataElement;
- }
+ void curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep);
inline void closeSubpath() {
int element_count = m_elements.size();
@@ -209,14 +204,11 @@ public:
public:
QDataBuffer<QPainterPath::ElementType> m_element_types;
QDataBuffer<QPointF> m_elements;
- QDataBuffer<QPointF> m_elements_dev;
QDataBuffer<QT_FT_Vector> m_points;
QDataBuffer<char> m_tags;
QDataBuffer<int> m_contours;
QRect m_clip_rect;
- QDataBuffer<QPointF> m_polygon_dev;
-
QRectF controlPointRect; // only valid after endOutline()
QT_FT_Outline m_outline;
@@ -235,6 +227,8 @@ public:
qreal m_dx;
qreal m_dy;
+ qreal m_curve_threshold;
+
bool m_valid;
bool m_in_clip_elements;