From cb04e54252e69fd794aff1ab7ab5ef6c4fbcafad Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 28 Jul 2009 15:49:01 +0200 Subject: Implement perspective filling support in the raster engine... Reviewed-by: Samuel --- src/gui/painting/qdatabuffer_p.h | 17 +++++++++++ src/gui/painting/qoutlinemapper.cpp | 59 ++++++++++++++++++++++++------------- 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h index 275ec13..b568f43 100644 --- a/src/gui/painting/qdatabuffer_p.h +++ b/src/gui/painting/qdatabuffer_p.h @@ -114,6 +114,23 @@ public: qSwap(buffer, other.buffer); } + inline void insertBlank(int pos, int count) { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos < siz); + reserve(siz + count); + for (int i = siz - pos - 1; i >= 0; --i) + buffer[pos + count + i] = buffer[pos + i]; + siz += count; + } + + inline void removeAndShift(int pos, int count) { + Q_ASSERT(pos >= 0); + Q_ASSERT(pos < siz); + for (int i=pos; i 3) + m_element_types.insertBlank(t, segment.size() - 3); + else if (segment.size() < 3) + m_element_types.removeAndShift(t, 3 - segment.size()); + + for (QPolygonF::const_iterator it = segment.constBegin(); + it < segment.constEnd(); ++it, ++t) { + m_elements_dev << *it * matrix; + m_element_types.at(t) = QPainterPath::LineToElement; + } i += 2; - break; + } break; default: Q_ASSERT(false); break; } } + element_count = m_elements_dev.size(); } - path = QTransform(m_m11, m_m12, m_m13, m_m21, m_m22, m_m23, m_dx, m_dy, m_m33).map(path); - uint old_txop = m_txop; - m_txop = QTransform::TxNone; - if (path.isEmpty()) - m_valid = false; - else - convertPath(path); - m_txop = old_txop; - return; } elements = m_elements_dev.data(); } if (m_round_coords) { // round coordinates to match outlines drawn with drawLine_midpoint_i - for (int i = 0; i < m_elements.size(); ++i) + for (int i = 0; i < element_count; ++i) elements[i] = QPointF(qFloor(elements[i].x() + aliasedCoordinateDelta), qFloor(elements[i].y() + aliasedCoordinateDelta)); } +#ifdef QT_DEBUG_CONVERT + for (int i=0; i