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

Commit 4460616e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[Shadows] Add shadow radius to sf layer state (2/n)"

parents 70d79c01 c97b8dbd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -406,6 +406,12 @@ void layer_state_t::merge(const layer_state_t& other) {
        what |= eMetadataChanged;
        metadata.merge(other.metadata);
    }

    if (other.what & eShadowRadiusChanged) {
        what |= eShadowRadiusChanged;
        shadowRadius = other.shadowRadius;
    }

    if ((other.what & what) != other.what) {
        ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? "
              "other.what=0x%" PRIu64 " what=0x%" PRIu64,
+12 −0
Original line number Diff line number Diff line
@@ -1337,6 +1337,18 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setGeome
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setShadowRadius(
        const sp<SurfaceControl>& sc, float shadowRadius) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }
    s->what |= layer_state_t::eShadowRadiusChanged;
    s->shadowRadius = shadowRadius;
    return *this;
}

// ---------------------------------------------------------------------------

DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
+6 −2
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ struct layer_state_t {
        eCropChanged_legacy = 0x00000100,
        eDeferTransaction_legacy = 0x00000200,
        eOverrideScalingModeChanged = 0x00000400,
        // AVAILABLE 0x00000800,
        eShadowRadiusChanged = 0x00000800,
        eReparentChildren = 0x00001000,
        eDetachChildren = 0x00002000,
        eRelativeLayerChanged = 0x00004000,
@@ -126,7 +126,8 @@ struct layer_state_t {
            colorTransform(mat4()),
            bgColorAlpha(0),
            bgColorDataspace(ui::Dataspace::UNKNOWN),
            colorSpaceAgnostic(false) {
            colorSpaceAgnostic(false),
            shadowRadius(0.0f) {
        matrix.dsdx = matrix.dtdy = 1.0f;
        matrix.dsdy = matrix.dtdx = 0.0f;
        hdrMetadata.validTypes = 0;
@@ -204,6 +205,9 @@ struct layer_state_t {
    bool colorSpaceAgnostic;

    std::vector<ListenerCallbacks> listeners;

    // Draws a shadow around the surface.
    float shadowRadius;
};

struct ComposerState {
+1 −0
Original line number Diff line number Diff line
@@ -474,6 +474,7 @@ public:

        Transaction& setGeometry(const sp<SurfaceControl>& sc,
                const Rect& source, const Rect& dst, int transform);
        Transaction& setShadowRadius(const sp<SurfaceControl>& sc, float cornerRadius);

        status_t setDisplaySurface(const sp<IBinder>& token,
                const sp<IGraphicBufferProducer>& bufferProducer);
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public:
    bool isCreatedFromMainThread() const override { return true; }

protected:
    bool canDrawShadows() const override { return false; }
    sp<Layer> createClone() override;
};

Loading