Use reserve on QVector<Phase2Data>
Summary: We know that the maximum size is the number of windows in stacking order. It might be that some are skipped as they are not ready for painting, but overall it's better to reserve a little bit too much memory than to have a growing QVector. Test Plan: Compiles Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D18208
This commit is contained in:
parent
d17a3ff88f
commit
33c7edaaf4
1 changed files with 2 additions and 0 deletions
|
@ -207,6 +207,7 @@ void Scene::paintGenericScreen(int orig_mask, ScreenPaintData)
|
|||
paintBackground(infiniteRegion());
|
||||
}
|
||||
QVector<Phase2Data> phase2;
|
||||
phase2.reserve(stacking_order.size());
|
||||
foreach (Window * w, stacking_order) { // bottom to top
|
||||
Toplevel* topw = w->window();
|
||||
|
||||
|
@ -250,6 +251,7 @@ void Scene::paintSimpleScreen(int orig_mask, QRegion region)
|
|||
assert((orig_mask & (PAINT_SCREEN_TRANSFORMED
|
||||
| PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS)) == 0);
|
||||
QVector<Phase2Data> phase2data;
|
||||
phase2data.reserve(stacking_order.size());
|
||||
|
||||
QRegion dirtyArea = region;
|
||||
bool opaqueFullscreen(false);
|
||||
|
|
Loading…
Reference in a new issue