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

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

Merge "Add plumbing for sending stretch effect to SF" into sc-dev

parents 70091d66 cdb4ed77
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -167,6 +167,9 @@ status_t layer_state_t::write(Parcel& output) const
        SAFE_PARCEL(output.writeInt32, region.right);
        SAFE_PARCEL(output.writeInt32, region.bottom);
    }

    SAFE_PARCEL(output.write, stretchEffect);

    return NO_ERROR;
}

@@ -290,6 +293,9 @@ status_t layer_state_t::read(const Parcel& input)
        SAFE_PARCEL(input.readInt32, &region.bottom);
        blurRegions.push_back(region);
    }

    SAFE_PARCEL(input.read, stretchEffect);

    return NO_ERROR;
}

+17 −0
Original line number Diff line number Diff line
@@ -1569,6 +1569,23 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setApply
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setStretchEffect(
        const sp<SurfaceControl>& sc, float left, float top, float right, float bottom, float vecX,
        float vecY, float maxAmount) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }

    s->what |= layer_state_t::eStretchChanged;
    s->stretchEffect = StretchEffect{.area = {left, top, right, bottom},
                                     .vectorX = vecX,
                                     .vectorY = vecY,
                                     .maxAmount = maxAmount};
    return *this;
}

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

DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {
+5 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@
#include <ui/Rect.h>
#include <ui/Region.h>
#include <ui/Rotation.h>
#include <ui/StretchEffect.h>
#include <ui/Transform.h>
#include <utils/Errors.h>

@@ -135,6 +136,7 @@ struct layer_state_t {
        eFrameTimelineInfoChanged = 0x800'00000000,
        eBlurRegionsChanged = 0x1000'00000000,
        eAutoRefreshChanged = 0x2000'00000000,
        eStretchChanged = 0x4000'00000000,
    };

    layer_state_t();
@@ -244,6 +246,9 @@ struct layer_state_t {
    // can and not wait for a frame to become available. This is only relevant
    // in shared buffer mode.
    bool autoRefresh;

    // Stretch effect to be applied to this layer
    StretchEffect stretchEffect;
};

struct ComposerState {
+4 −0
Original line number Diff line number Diff line
@@ -550,6 +550,10 @@ public:
        // transactions from blocking each other.
        Transaction& setApplyToken(const sp<IBinder>& token);

        Transaction& setStretchEffect(const sp<SurfaceControl>& sc, float left, float top,
                                      float right, float bottom, float vecX, float vecY,
                                      float maxAmount);

        status_t setDisplaySurface(const sp<IBinder>& token,
                const sp<IGraphicBufferProducer>& bufferProducer);

+3 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <ui/GraphicTypes.h>
#include <ui/Rect.h>
#include <ui/Region.h>
#include <ui/StretchEffect.h>
#include <ui/Transform.h>

namespace android {
@@ -155,6 +156,8 @@ struct LayerSettings {

    std::vector<BlurRegion> blurRegions;

    StretchEffect stretchEffect;

    // Name associated with the layer for debugging purposes.
    std::string name;
};
Loading