From 307825ca6380594f48baf61fbe11f4d8c54b649e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 8 Apr 2016 14:09:21 +0200 Subject: [PATCH] Do not clip or rasterize paths completely outside the device rect The controlPointRect is a conservative area that is guaranteed to contain the path, if that does not intersect with the painter's device rect, the path must be fully outside the painted area, and can be ignored. Change-Id: If14d7dbaf916aa284b941d01e773da3365dce5bf Reviewed-by: Gunnar Sletta --- src/gui/painting/qpaintengine_raster.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 348ccfffda..d3b4acbbcd 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1693,8 +1693,12 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) // ### Optimize for non transformed ellipses and rectangles... QRectF cpRect = path.controlPointRect(); - const QRect deviceRect = s->matrix.mapRect(cpRect).toRect(); - ProcessSpans blend = d->getBrushFunc(deviceRect, &s->brushData); + const QRect pathDeviceRect = s->matrix.mapRect(cpRect).toRect(); + // Skip paths that by conservative estimates are completely outside the paint device. + if (!pathDeviceRect.intersects(d->deviceRect)) + return; + + ProcessSpans blend = d->getBrushFunc(pathDeviceRect, &s->brushData); // ### Falcon // const bool do_clip = (deviceRect.left() < -QT_RASTER_COORD_LIMIT