Remove clipping against the bounding rect of paint region

This commit is contained in:
Martin Gräßlin 2011-06-26 13:16:14 +02:00
parent 050ea5010b
commit 76eb3c3391

View file

@ -479,45 +479,25 @@ void SceneOpenGL::Window::performPaint(int mask, QRegion region, WindowPaintData
if (region != infiniteRegion() && !(mask & PAINT_WINDOW_TRANSFORMED)) { if (region != infiniteRegion() && !(mask & PAINT_WINDOW_TRANSFORMED)) {
WindowQuadList quads; WindowQuadList quads;
const QRegion filterRegion = region.translated(-x(), -y()); const QRegion filterRegion = region.translated(-x(), -y());
const QRectF bounding = QRectF(filterRegion.boundingRect()); // split all quads in bounding rect with the actual rects in the region
// first step: split all quads according to the bounding rect
foreach (const WindowQuad &quad, data.quads) { 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()) { foreach (const QRect &r, filterRegion.rects()) {
const QRectF rf(r); const QRectF rf(r);
const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom())); const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom()));
// case 1: completely contains, include and do not check other rects // case 1: completely contains, include and do not check other rects
if (rf.contains(quadRect)) { if (rf.contains(quadRect)) {
tempList << quad; quads << quad;
break; break;
} }
// case 2: intersection // case 2: intersection
if (rf.intersects(quadRect)) { if (rf.intersects(quadRect)) {
const QRectF intersected = rf.intersected(quadRect); const QRectF intersected = rf.intersected(quadRect);
tempList << quad.makeSubQuad(intersected.left(), intersected.top(), intersected.right(), intersected.bottom()); quads << quad.makeSubQuad(intersected.left(), intersected.top(), intersected.right(), intersected.bottom());
} }
} }
} }
data.quads = tempList;
} else {
data.quads = quads; data.quads = quads;
} }
}
if (!bindTexture()) if (!bindTexture())
return; return;