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

Commit cdb4ed77 authored by John Reck's avatar John Reck
Browse files

Add plumbing for sending stretch effect to SF

Bug: 179047472
Test: builds & boots, doesn't do anything yet
Change-Id: Ib8cccdde518f0591c2f2ee3416684442f37a1e06
parent e5d7b701
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
@@ -551,6 +551,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