From b46b5518a7472fa1591bdc402ab4f2f5be07cc5b Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 12 Jan 2010 15:13:46 +0100 Subject: Avoid coordinate limitations in the raster engine. Lines that are longer than 2^15 will overflow in qgrayraster.c so we need to clip them. Also, we need to clip the bounding rectangle to avoid an endless clip-loop Task: http://bugreports.qt.nokia.com/browse/QTBUG-6198 Reviewed-by: Samuel (cherry picked from commit d4e81805ff47a266890f9638cf29647889d5c730) --- src/gui/painting/qoutlinemapper.cpp | 9 ++++++--- src/gui/painting/qpaintengine_raster.cpp | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index 9f4cc4b..72d56a9 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -225,9 +225,10 @@ void QOutlineMapper::endOutline() controlPointRect = boundingRect(elements, element_count); #ifdef QT_DEBUG_CONVERT - printf(" - control point rect (%.2f, %.2f) %.2f x %.2f\n", + printf(" - control point rect (%.2f, %.2f) %.2f x %.2f, clip=(%d,%d, %dx%d)\n", controlPointRect.x(), controlPointRect.y(), - controlPointRect.width(), controlPointRect.height()); + controlPointRect.width(), controlPointRect.height(), + m_clip_rect.x(), m_clip_rect.y(), m_clip_rect.width(), m_clip_rect.height()); #endif @@ -235,7 +236,9 @@ void QOutlineMapper::endOutline() const bool do_clip = (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.bottom() > QT_RASTER_COORD_LIMIT + || controlPointRect.width() > QT_RASTER_COORD_LIMIT + || controlPointRect.height() > QT_RASTER_COORD_LIMIT); if (do_clip) { clipElements(elements, elementTypes(), element_count); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index ba8eca7..80dd0b1 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -475,8 +475,10 @@ 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, - 2*QT_RASTER_COORD_LIMIT, 2*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); -- cgit v0.12