diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2010-06-16 10:10:03 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2010-06-16 10:20:59 (GMT) |
commit | 7619c210217c85ef6e8d3571cce5d1272b1cb437 (patch) | |
tree | cbaa3a135f012ecd31494fd9c136167bed1347e2 | |
parent | 64e60dab167afc68cfb94a8eb0b7469eea9a4291 (diff) | |
download | Qt-7619c210217c85ef6e8d3571cce5d1272b1cb437.zip Qt-7619c210217c85ef6e8d3571cce5d1272b1cb437.tar.gz Qt-7619c210217c85ef6e8d3571cce5d1272b1cb437.tar.bz2 |
Fixed infinite recursion when drawing very large painter paths.
Task-number: QTBUG-11291
Reviewed-by: Gunnar
-rw-r--r-- | src/gui/painting/qoutlinemapper.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qoutlinemapper_p.h | 4 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 11 |
3 files changed, 14 insertions, 9 deletions
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index 962f34c..bf03545 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -234,12 +234,12 @@ void QOutlineMapper::endOutline() // Check for out of dev bounds... - const bool do_clip = (controlPointRect.left() < -QT_RASTER_COORD_LIMIT + const bool do_clip = !m_in_clip_elements && ((controlPointRect.left() < -QT_RASTER_COORD_LIMIT || controlPointRect.right() > QT_RASTER_COORD_LIMIT || controlPointRect.top() < -QT_RASTER_COORD_LIMIT || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT || controlPointRect.width() > QT_RASTER_COORD_LIMIT - || controlPointRect.height() > QT_RASTER_COORD_LIMIT); + || controlPointRect.height() > QT_RASTER_COORD_LIMIT)); if (do_clip) { clipElements(elements, elementTypes(), element_count); @@ -353,6 +353,8 @@ void QOutlineMapper::clipElements(const QPointF *elements, // instead of going through convenience functionallity, but since // this part of code hardly every used, it shouldn't matter. + m_in_clip_elements = true; + QPainterPath path; if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL)) @@ -393,6 +395,8 @@ void QOutlineMapper::clipElements(const QPointF *elements, else convertPath(clippedPath); m_txop = old_txop; + + m_in_clip_elements = false; } QT_END_NAMESPACE diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h index 39b7593..f64d03b 100644 --- a/src/gui/painting/qoutlinemapper_p.h +++ b/src/gui/painting/qoutlinemapper_p.h @@ -95,7 +95,8 @@ public: m_tags(0), m_contours(0), m_polygon_dev(0), - m_round_coords(false) + m_round_coords(false), + m_in_clip_elements(false) { } @@ -235,6 +236,7 @@ public: qreal m_dy; bool m_valid; + bool m_in_clip_elements; private: bool m_round_coords; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index f10f12f..a212718 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -459,13 +459,12 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) QRasterPaintEngineState *s = state(); ensureOutlineMapper(); - d->outlineMapper->m_clip_rect = d->deviceRect.adjusted(-10, -10, 10, 10); - - // This is the upp - QRect bounds(-QT_RASTER_COORD_LIMIT, -QT_RASTER_COORD_LIMIT, - QT_RASTER_COORD_LIMIT*2 - 1, QT_RASTER_COORD_LIMIT * 2 - 1); - d->outlineMapper->m_clip_rect = bounds.intersected(d->outlineMapper->m_clip_rect); + d->outlineMapper->m_clip_rect = d->deviceRect; + if (d->outlineMapper->m_clip_rect.width() > QT_RASTER_COORD_LIMIT) + d->outlineMapper->m_clip_rect.setWidth(QT_RASTER_COORD_LIMIT); + if (d->outlineMapper->m_clip_rect.height() > QT_RASTER_COORD_LIMIT) + d->outlineMapper->m_clip_rect.setHeight(QT_RASTER_COORD_LIMIT); d->rasterizer->setClipRect(d->deviceRect); |