From 76eb3c3391ddd88d28c73e190ddeb2aee8dda38b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 26 Jun 2011 13:16:14 +0200 Subject: [PATCH] Remove clipping against the bounding rect of paint region --- scene_opengl.cpp | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 0f83d2c8a6..571cb74462 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -479,44 +479,24 @@ void SceneOpenGL::Window::performPaint(int mask, QRegion region, WindowPaintData if (region != infiniteRegion() && !(mask & PAINT_WINDOW_TRANSFORMED)) { WindowQuadList quads; const QRegion filterRegion = region.translated(-x(), -y()); - const QRectF bounding = QRectF(filterRegion.boundingRect()); - // first step: split all quads according to the bounding rect + // split all quads in bounding rect with the actual rects in the region foreach (const WindowQuad &quad, data.quads) { - const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom())); - // case 1: completely contains - if (bounding.contains(quadRect)) { - quads << quad; - continue; - } - // case 2: intersection - if (bounding.intersects(quadRect)) { - const QRectF intersected = bounding.intersected(quadRect); - quads << quad.makeSubQuad(intersected.left(), intersected.top(), intersected.right(), intersected.bottom()); - } - } - if (filterRegion.numRects() > 1) { - // second step: split all quads in bounding rect with the actual rects in the region - WindowQuadList tempList; - foreach (const WindowQuad &quad, quads) { - foreach (const QRect &r, filterRegion.rects()) { - const QRectF rf(r); - const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom())); - // case 1: completely contains, include and do not check other rects - if (rf.contains(quadRect)) { - tempList << quad; - break; - } - // case 2: intersection - if (rf.intersects(quadRect)) { - const QRectF intersected = rf.intersected(quadRect); - tempList << quad.makeSubQuad(intersected.left(), intersected.top(), intersected.right(), intersected.bottom()); - } + foreach (const QRect &r, filterRegion.rects()) { + const QRectF rf(r); + const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom())); + // case 1: completely contains, include and do not check other rects + if (rf.contains(quadRect)) { + quads << quad; + break; + } + // case 2: intersection + if (rf.intersects(quadRect)) { + const QRectF intersected = rf.intersected(quadRect); + quads << quad.makeSubQuad(intersected.left(), intersected.top(), intersected.right(), intersected.bottom()); } } - data.quads = tempList; - } else { - data.quads = quads; } + data.quads = quads; } if (!bindTexture())