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

Commit ca10ed2c authored by David Sodman's avatar David Sodman
Browse files

Revert "Revert "SF: Add support for screen captures""

This reverts commit 2156613b.

Test: Manual and cts -m ViewTestCases

Change-Id: Ia1de956a2f41ecd3e019c8540a60d42c37bc343e
parent 8501e366
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -160,6 +160,8 @@ void BufferLayer::onDraw(const RenderArea& renderArea, const Region& clip,
                         bool useIdentityTransform) const {
    ATRACE_CALL();

    CompositionInfo& compositionInfo = getBE().compositionInfo;

    if (CC_UNLIKELY(mActiveBuffer == 0)) {
        // the texture has not been created yet, this Layer has
        // in fact never been drawn into. This happens frequently with
@@ -241,6 +243,7 @@ void BufferLayer::onDraw(const RenderArea& renderArea, const Region& clip,
        mTexture.setDimensions(mActiveBuffer->getWidth(), mActiveBuffer->getHeight());
        mTexture.setFiltering(useFiltering);
        mTexture.setMatrix(textureMatrix);
        compositionInfo.re.texture = mTexture;

        engine.setupLayerTexturing(mTexture);
    } else {
@@ -250,6 +253,23 @@ void BufferLayer::onDraw(const RenderArea& renderArea, const Region& clip,
    engine.disableTexturing();
}

void BufferLayer::drawNow(const RenderArea& renderArea, bool useIdentityTransform) const {
    CompositionInfo& compositionInfo = getBE().compositionInfo;
    auto& engine(mFlinger->getRenderEngine());

    draw(renderArea, useIdentityTransform);

    engine.setupLayerTexturing(compositionInfo.re.texture);
    engine.setupLayerBlending(compositionInfo.re.preMultipliedAlpha, compositionInfo.re.opaque,
            false, compositionInfo.re.color);
    engine.setSourceDataSpace(compositionInfo.hwc.dataspace);
    engine.setSourceY410BT2020(compositionInfo.re.Y410BT2020);
    engine.drawMesh(getBE().getMesh());
    engine.disableBlending();
    engine.disableTexturing();
    engine.setSourceY410BT2020(false);
}

void BufferLayer::onLayerDisplayed(const sp<Fence>& releaseFence) {
    mConsumer->setReleaseFence(releaseFence);
}
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ public:
     */
    void onDraw(const RenderArea& renderArea, const Region& clip,
                bool useIdentityTransform) const override;
    void drawNow(const RenderArea& renderArea, bool useIdentityTransform) const;

    void onLayerDisplayed(const sp<Fence>& releaseFence) override;

+18 −7
Original line number Diff line number Diff line
@@ -46,15 +46,26 @@ void ColorLayer::onDraw(const RenderArea& renderArea, const Region& /* clip */,
                        bool useIdentityTransform) const {
    half4 color = getColor();
    if (color.a > 0) {
        Mesh mesh(Mesh::TRIANGLE_FAN, 4, 2);
        computeGeometry(renderArea, mesh, useIdentityTransform);
        computeGeometry(renderArea, getBE().mMesh, useIdentityTransform);
        getBE().compositionInfo.re.preMultipliedAlpha = getPremultipledAlpha();
        getBE().compositionInfo.re.opaque = false;
        getBE().compositionInfo.re.disableTexture = true;
        getBE().compositionInfo.re.color = color;
    }
}

void ColorLayer::drawNow(const RenderArea& renderArea, bool useIdentityTransform) const {
    CompositionInfo& compositionInfo = getBE().compositionInfo;
    auto& engine(mFlinger->getRenderEngine());
        engine.setupLayerBlending(getPremultipledAlpha(), false /* opaque */,
                                  true /* disableTexture */, color);
        engine.drawMesh(mesh);

    draw(renderArea, useIdentityTransform);

    engine.setupLayerBlending(compositionInfo.re.preMultipliedAlpha, compositionInfo.re.opaque,
            compositionInfo.re.disableTexture, compositionInfo.re.color);
    engine.setSourceDataSpace(compositionInfo.hwc.dataspace);
    engine.drawMesh(getBE().getMesh());
    engine.disableBlending();
}
}

bool ColorLayer::isVisible() const {
    const Layer::State& s(getDrawingState());
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ public:
    virtual const char* getTypeId() const { return "ColorLayer"; }
    virtual void onDraw(const RenderArea& renderArea, const Region& clip,
                        bool useIdentityTransform) const;
    void drawNow(const RenderArea& , bool ) const;
    bool isVisible() const override;

    void setPerFrameData(const sp<const DisplayDevice>& display) override;
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ ContainerLayer::ContainerLayer(SurfaceFlinger* flinger, const sp<Client>& client

void ContainerLayer::onDraw(const RenderArea&, const Region& /* clip */, bool) const {}

void ContainerLayer::drawNow(const RenderArea&, bool) const {}

bool ContainerLayer::isVisible() const {
    return !isHiddenByPolicy();
}
Loading