Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit a63c9ab3 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[effects/slidingpopups] Reserve enough memory for filtered quads

Summary: That's to avoid unnecessary reallocations.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14085
parent 461aace5
......@@ -146,6 +146,7 @@ void SlidingPopupsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da
const double splitPoint = geo.width() - (geo.x() + geo.width() - screenRect.x() - start) + qMin(geo.width(), slideLength) * (appearing ? 1.0 - progress : progress);
data.quads = data.quads.splitAtX(splitPoint);
WindowQuadList filtered;
filtered.reserve(data.quads.count());
foreach (const WindowQuad &quad, data.quads) {
if (quad.left() >= splitPoint) {
filtered << quad;
......@@ -158,6 +159,7 @@ void SlidingPopupsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da
const double splitPoint = geo.height() - (geo.y() + geo.height() - screenRect.y() - start) + qMin(geo.height(), slideLength) * (appearing ? 1.0 - progress : progress);
data.quads = data.quads.splitAtY(splitPoint);
WindowQuadList filtered;
filtered.reserve(data.quads.count());
foreach (const WindowQuad &quad, data.quads) {
if (quad.top() >= splitPoint) {
filtered << quad;
......@@ -170,6 +172,7 @@ void SlidingPopupsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da
const double splitPoint = screenRect.x() + screenRect.width() - geo.x() - start - qMin(geo.width(), slideLength) * (appearing ? 1.0 - progress : progress);
data.quads = data.quads.splitAtX(splitPoint);
WindowQuadList filtered;
filtered.reserve(data.quads.count());
foreach (const WindowQuad &quad, data.quads) {
if (quad.right() <= splitPoint) {
filtered << quad;
......@@ -183,6 +186,7 @@ void SlidingPopupsEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& da
const double splitPoint = screenRect.y() + screenRect.height() - geo.y() - start - qMin(geo.height(), slideLength) * (appearing ? 1.0 - progress : progress);
data.quads = data.quads.splitAtY(splitPoint);
WindowQuadList filtered;
filtered.reserve(data.quads.count());
foreach (const WindowQuad &quad, data.quads) {
if (quad.bottom() <= splitPoint) {
filtered << quad;
......
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