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

Commit 61be455e authored by Pablo Ceballos's avatar Pablo Ceballos Committed by android-build-merger
Browse files

Merge "Add final crop implementation" into nyc-dev

am: 41371bfa

* commit '41371bfa':
  Add final crop implementation
parents b8ce3f9b 41371bfa
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -133,6 +133,7 @@ public:
    status_t    setPosition(const sp<IBinder>& id, float x, float y);
    status_t    setPosition(const sp<IBinder>& id, float x, float y);
    status_t    setSize(const sp<IBinder>& id, uint32_t w, uint32_t h);
    status_t    setSize(const sp<IBinder>& id, uint32_t w, uint32_t h);
    status_t    setCrop(const sp<IBinder>& id, const Rect& crop);
    status_t    setCrop(const sp<IBinder>& id, const Rect& crop);
    status_t    setFinalCrop(const sp<IBinder>& id, const Rect& crop);
    status_t    setLayerStack(const sp<IBinder>& id, uint32_t layerStack);
    status_t    setLayerStack(const sp<IBinder>& id, uint32_t layerStack);
    status_t    deferTransactionUntil(const sp<IBinder>& id,
    status_t    deferTransactionUntil(const sp<IBinder>& id,
            const sp<IBinder>& handle, uint64_t frameNumber);
            const sp<IBinder>& handle, uint64_t frameNumber);
+1 −0
Original line number Original line Diff line number Diff line
@@ -71,6 +71,7 @@ public:
    status_t    setAlpha(float alpha=1.0f);
    status_t    setAlpha(float alpha=1.0f);
    status_t    setMatrix(float dsdx, float dtdx, float dsdy, float dtdy);
    status_t    setMatrix(float dsdx, float dtdx, float dsdy, float dtdy);
    status_t    setCrop(const Rect& crop);
    status_t    setCrop(const Rect& crop);
    status_t    setFinalCrop(const Rect& crop);


    // Defers applying any changes made in this transaction until the Layer
    // Defers applying any changes made in this transaction until the Layer
    // identified by handle reaches the given frameNumber
    // identified by handle reaches the given frameNumber
+5 −2
Original line number Original line Diff line number Diff line
@@ -52,14 +52,16 @@ struct layer_state_t {
        eFlagsChanged               = 0x00000040,
        eFlagsChanged               = 0x00000040,
        eLayerStackChanged          = 0x00000080,
        eLayerStackChanged          = 0x00000080,
        eCropChanged                = 0x00000100,
        eCropChanged                = 0x00000100,
        eDeferTransaction           = 0x00000200
        eDeferTransaction           = 0x00000200,
        eFinalCropChanged           = 0x00000400
    };
    };


    layer_state_t()
    layer_state_t()
        :   what(0),
        :   what(0),
            x(0), y(0), z(0), w(0), h(0), layerStack(0),
            x(0), y(0), z(0), w(0), h(0), layerStack(0),
            alpha(0), flags(0), mask(0),
            alpha(0), flags(0), mask(0),
            reserved(0), crop(Rect::INVALID_RECT), frameNumber(0)
            reserved(0), crop(Rect::INVALID_RECT),
            finalCrop(Rect::INVALID_RECT), frameNumber(0)
    {
    {
        matrix.dsdx = matrix.dtdy = 1.0f;
        matrix.dsdx = matrix.dtdy = 1.0f;
        matrix.dsdy = matrix.dtdx = 0.0f;
        matrix.dsdy = matrix.dtdx = 0.0f;
@@ -88,6 +90,7 @@ struct layer_state_t {
            uint8_t         reserved;
            uint8_t         reserved;
            matrix22_t      matrix;
            matrix22_t      matrix;
            Rect            crop;
            Rect            crop;
            Rect            finalCrop;
            sp<IBinder>     handle;
            sp<IBinder>     handle;
            uint64_t        frameNumber;
            uint64_t        frameNumber;
            // non POD must be last. see write/read
            // non POD must be last. see write/read
+2 −0
Original line number Original line Diff line number Diff line
@@ -38,6 +38,7 @@ status_t layer_state_t::write(Parcel& output) const
    *reinterpret_cast<layer_state_t::matrix22_t *>(
    *reinterpret_cast<layer_state_t::matrix22_t *>(
            output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix;
            output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix;
    output.write(crop);
    output.write(crop);
    output.write(finalCrop);
    output.writeStrongBinder(handle);
    output.writeStrongBinder(handle);
    output.writeUint64(frameNumber);
    output.writeUint64(frameNumber);
    output.write(transparentRegion);
    output.write(transparentRegion);
@@ -64,6 +65,7 @@ status_t layer_state_t::read(const Parcel& input)
        return BAD_VALUE;
        return BAD_VALUE;
    }
    }
    input.read(crop);
    input.read(crop);
    input.read(finalCrop);
    handle = input.readStrongBinder();
    handle = input.readStrongBinder();
    frameNumber = input.readUint64();
    frameNumber = input.readUint64();
    input.read(transparentRegion);
    input.read(transparentRegion);
+19 −0
Original line number Original line Diff line number Diff line
@@ -156,6 +156,8 @@ public:
    status_t setOrientation(int orientation);
    status_t setOrientation(int orientation);
    status_t setCrop(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
    status_t setCrop(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
            const Rect& crop);
            const Rect& crop);
    status_t setFinalCrop(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id, const Rect& crop);
    status_t setLayerStack(const sp<SurfaceComposerClient>& client,
    status_t setLayerStack(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id, uint32_t layerStack);
            const sp<IBinder>& id, uint32_t layerStack);
    status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client,
    status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client,
@@ -386,6 +388,18 @@ status_t Composer::setCrop(const sp<SurfaceComposerClient>& client,
    return NO_ERROR;
    return NO_ERROR;
}
}


status_t Composer::setFinalCrop(const sp<SurfaceComposerClient>& client,
        const sp<IBinder>& id, const Rect& crop) {
    Mutex::Autolock _l(mLock);
    layer_state_t* s = getLayerStateLocked(client, id);
    if (!s) {
        return BAD_INDEX;
    }
    s->what |= layer_state_t::eFinalCropChanged;
    s->finalCrop = crop;
    return NO_ERROR;
}

status_t Composer::deferTransactionUntil(
status_t Composer::deferTransactionUntil(
        const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
        const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
        const sp<IBinder>& handle, uint64_t frameNumber) {
        const sp<IBinder>& handle, uint64_t frameNumber) {
@@ -579,6 +593,11 @@ status_t SurfaceComposerClient::setCrop(const sp<IBinder>& id, const Rect& crop)
    return getComposer().setCrop(this, id, crop);
    return getComposer().setCrop(this, id, crop);
}
}


status_t SurfaceComposerClient::setFinalCrop(const sp<IBinder>& id,
        const Rect& crop) {
    return getComposer().setFinalCrop(this, id, crop);
}

status_t SurfaceComposerClient::setPosition(const sp<IBinder>& id, float x, float y) {
status_t SurfaceComposerClient::setPosition(const sp<IBinder>& id, float x, float y) {
    return getComposer().setPosition(this, id, x, y);
    return getComposer().setPosition(this, id, x, y);
}
}
Loading