Remove clipping against the bounding rect of paint region
This commit is contained in:
parent
050ea5010b
commit
76eb3c3391
1 changed files with 14 additions and 34 deletions
|
@ -479,44 +479,24 @@ 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()));
|
foreach (const QRect &r, filterRegion.rects()) {
|
||||||
// case 1: completely contains
|
const QRectF rf(r);
|
||||||
if (bounding.contains(quadRect)) {
|
const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom()));
|
||||||
quads << quad;
|
// case 1: completely contains, include and do not check other rects
|
||||||
continue;
|
if (rf.contains(quadRect)) {
|
||||||
}
|
quads << quad;
|
||||||
// case 2: intersection
|
break;
|
||||||
if (bounding.intersects(quadRect)) {
|
}
|
||||||
const QRectF intersected = bounding.intersected(quadRect);
|
// case 2: intersection
|
||||||
quads << quad.makeSubQuad(intersected.left(), intersected.top(), intersected.right(), intersected.bottom());
|
if (rf.intersects(quadRect)) {
|
||||||
}
|
const QRectF intersected = rf.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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.quads = tempList;
|
|
||||||
} else {
|
|
||||||
data.quads = quads;
|
|
||||||
}
|
}
|
||||||
|
data.quads = quads;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bindTexture())
|
if (!bindTexture())
|
||||||
|
|
Loading…
Reference in a new issue