Android: port away from QRegion::rects()

Use being()/end() instead.

The region of whose rects() we iterate here is modified in the loop
body, so take a copy of the rectangles. Since QVector is still
missing a range constructor, use std::vector. This does not cause
extra copies, since the QVector inside QRegion would detach anyway,
when the QRegion is modified inside the loop.

Change-Id: Ib973e825b55d9c9568936cb80180858163d87379
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
Marc Mutz 2017-12-07 09:45:48 +01:00
parent 87ae689ed6
commit cd56e843cc

View File

@ -59,6 +59,8 @@
#include <QtGui/QWindow>
#include <QtGui/private/qwindow_p.h>
#include <vector>
QT_BEGIN_NAMESPACE
#ifdef QANDROIDPLATFORMSCREEN_DEBUG
@ -376,8 +378,7 @@ void QAndroidPlatformScreen::doRedraw()
|| !window->isRaster())
continue;
const QVector<QRect> visibleRects = visibleRegion.rects();
for (const QRect &rect : visibleRects) {
for (const QRect &rect : std::vector<QRect>(visibleRegion.begin(), visibleRegion.end())) {
QRect targetRect = window->geometry();
targetRect &= rect;