Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04b992cb authored by Leon Scroggins III's avatar Leon Scroggins III Committed by Leon Scroggins
Browse files

SF: Only buildCachedSets if (mergeWithCachedSets)

Bug: 163076219
Test: make

When mergeWithCachedSets returns false, mLayers contains only CachedSets
with the current time_point. So no layers will be determined to be
"inactive" in buildCachedSets, so it will never create any Runs or an
mNewCachedSet.

Change-Id: Id305effec2e49530bd3c05804ee354ad2044ab56
parent e55d11e1
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -40,13 +40,17 @@ NonBufferHash Flattener::flattenLayers(const std::vector<const LayerState*>& lay

    ++mInitialLayerCounts[layers.size()];

    if (mergeWithCachedSets(layers, now)) {
        hash = computeLayersHash();
    }
    // Only buildCachedSets if these layers are already stored in mLayers.
    // Otherwise (i.e. mergeWithCachedSets returns false), the time has not
    // changed, so buildCachedSets will never find any runs.
    const bool alreadyHadCachedSets = mergeWithCachedSets(layers, now);

    ++mFinalLayerCounts[mLayers.size()];

    if (alreadyHadCachedSets) {
        buildCachedSets(now);
        hash = computeLayersHash();
    }

    return hash;
}
@@ -177,6 +181,9 @@ NonBufferHash Flattener::computeLayersHash() const{
    return hash;
}

// Only called if the geometry matches the last frame. Return true if mLayers
// was already populated with these layers, i.e. on the second and following
// calls with the same geometry.
bool Flattener::mergeWithCachedSets(const std::vector<const LayerState*>& layers, time_point now) {
    std::vector<CachedSet> merged;