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

Commit 7c47898d authored by Derek Sollenberger's avatar Derek Sollenberger Committed by Android (Google) Code Review
Browse files

Merge "Only flush after all layers are drawn instead of after each layer."

parents 19d18524 f7df184f
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -83,7 +83,8 @@ void SkiaPipeline::renderLayers(const FrameBuilder::LightGeometry& lightGeometry

void SkiaPipeline::renderLayersImpl(const LayerUpdateQueue& layers,
        bool opaque, bool wideColorGamut) {
    // TODO: Handle wide color gamut
    sk_sp<GrContext> cachedContext;

    // Render all layers that need to be updated, in order.
    for (size_t i = 0; i < layers.entries().size(); i++) {
        RenderNode* layerNode = layers.entries()[i].renderNode.get();
@@ -126,12 +127,25 @@ void SkiaPipeline::renderLayersImpl(const LayerUpdateQueue& layers,
            RenderNodeDrawable root(layerNode, layerCanvas, false);
            root.forceDraw(layerCanvas);
            layerCanvas->restoreToCount(saveCount);
            layerCanvas->flush();
            mLightCenter = savedLightCenter;

            // cache the current context so that we can defer flushing it until
            // either all the layers have been rendered or the context changes
            GrContext* currentContext = layerCanvas->getGrContext();
            if (cachedContext.get() != currentContext) {
                if (cachedContext.get()) {
                    cachedContext->flush();
                }
                cachedContext.reset(SkSafeRef(currentContext));
            }
        }
    }

    if (cachedContext.get()) {
        cachedContext->flush();
    }
}

bool SkiaPipeline::createOrUpdateLayer(RenderNode* node,
        const DamageAccumulator& damageAccumulator, bool wideColorGamut) {
    SkSurface* layer = node->getLayerSurface();