Commit 9e8773cb authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Contrast / Blur Effects] Port from QRegion::rects() to QRegion iterators

Especially the BlurEffect::expanded() method is called a lot.
Saves creating a temporary QVector.

Differential Revision: https://phabricator.kde.org/D9101
parent c3d41046
......@@ -271,7 +271,7 @@ QRegion ContrastEffect::contrastRegion(const EffectWindow *w) const
void ContrastEffect::uploadRegion(QVector2D *&map, const QRegion &region)
{
foreach (const QRect &r, region.rects()) {
for (const QRect &r : region) {
const QVector2D topLeft(r.x(), r.y());
const QVector2D topRight(r.x() + r.width(), r.y());
const QVector2D bottomLeft(r.x(), r.y() + r.height());
......
......@@ -238,7 +238,7 @@ QRegion BlurEffect::expand(const QRegion &region) const
{
QRegion expanded;
foreach (const QRect & rect, region.rects()) {
for (const QRect &rect : region) {
expanded += expand(rect);
}
......@@ -276,7 +276,7 @@ QRegion BlurEffect::blurRegion(const EffectWindow *w) const
void BlurEffect::uploadRegion(QVector2D *&map, const QRegion &region)
{
foreach (const QRect &r, region.rects()) {
for (const QRect &r : region) {
const QVector2D topLeft(r.x(), r.y());
const QVector2D topRight(r.x() + r.width(), r.y());
const QVector2D bottomLeft(r.x(), r.y() + r.height());
......@@ -339,7 +339,7 @@ void BlurEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int t
QRegion newClip;
const QRegion oldClip = data.clip;
const int radius = shader->radius();
foreach (const QRect& rect, data.clip.rects()) {
for (const QRect &rect : data.clip) {
newClip |= rect.adjusted(radius,radius,-radius,-radius);
}
data.clip = newClip;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment