summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2010-01-12 14:13:46 (GMT)
committerJesper Thomschutz <jesper.thomschutz@nokia.com>2010-01-13 13:27:15 (GMT)
commitb46b5518a7472fa1591bdc402ab4f2f5be07cc5b (patch)
tree2f320ccd1e1666473cea352dfd70d57908a45d4b /src
parentd69b643012089d098c9ac45a03c03551b1e4766e (diff)
downloadQt-b46b5518a7472fa1591bdc402ab4f2f5be07cc5b.zip
Qt-b46b5518a7472fa1591bdc402ab4f2f5be07cc5b.tar.gz
Qt-b46b5518a7472fa1591bdc402ab4f2f5be07cc5b.tar.bz2
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)
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qoutlinemapper.cpp9
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
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);