[SceneOpenGL] Port from QRegion::rects() to QRegion iterators

This code path is executed a lot. Saves creating a temporary QVector.

Differential Revision: https://phabricator.kde.org/D9081
This commit is contained in:
Kai Uwe Broulik 2017-12-02 10:05:04 +01:00
parent 873d38225e
commit e9a2124669

View file

@ -798,7 +798,7 @@ void SceneOpenGL::extendPaintRegion(QRegion &region, bool opaqueFullscreen)
// movie aspect - two times ;-) It's a Fox format, though, so maybe we want to restrict // movie aspect - two times ;-) It's a Fox format, though, so maybe we want to restrict
// to 2.20:1 - Panavision - which has actually been used for interesting movies ...) // to 2.20:1 - Panavision - which has actually been used for interesting movies ...)
// would be 57% of 5/4 // would be 57% of 5/4
foreach (const QRect &r, region.rects()) { for (const QRect &r : region) {
// damagedPixels += r.width() * r.height(); // combined window damage test // damagedPixels += r.width() * r.height(); // combined window damage test
damagedPixels = r.width() * r.height(); // experimental single window damage testing damagedPixels = r.width() * r.height(); // experimental single window damage testing
if (damagedPixels > fullRepaintLimit) { if (damagedPixels > fullRepaintLimit) {
@ -1178,7 +1178,7 @@ bool SceneOpenGL::Window::beginRenderWindow(int mask, const QRegion &region, Win
const QRegion filterRegion = region.translated(-x(), -y()); const QRegion filterRegion = region.translated(-x(), -y());
// split all quads in bounding rect with the actual rects in the region // split all quads in bounding rect with the actual rects in the region
foreach (const WindowQuad &quad, data.quads) { foreach (const WindowQuad &quad, data.quads) {
foreach (const QRect &r, filterRegion.rects()) { for (const QRect &r : filterRegion) {
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()));
const QRectF &intersected = rf.intersected(quadRect); const QRectF &intersected = rf.intersected(quadRect);