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

Commit f1da94b9 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Use transform, width, and height instead of active and requested" into sc-dev

parents 807ae39c 4e76553e
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -51,9 +51,6 @@ public:
        return flags;
    }

    uint32_t getActiveWidth(const Layer::State& s) const override { return s.width; }
    uint32_t getActiveHeight(const Layer::State& s) const override { return s.height; }
    ui::Transform getActiveTransform(const Layer::State& s) const override { return s.transform; }
    Region getActiveTransparentRegion(const Layer::State& s) const override {
        return s.transparentRegionHint;
    }
+14 −16
Original line number Diff line number Diff line
@@ -858,7 +858,7 @@ uint32_t Layer::doTransaction(uint32_t flags) {
    const State& s(getDrawingState());
    State& c(getCurrentState());

    if (getActiveGeometry(c) != getActiveGeometry(s)) {
    if (c.width != s.width || c.height != s.height || !(c.transform == s.transform)) {
        // invalidate and recompute the visible regions if needed
        flags |= Layer::eVisibleRegion;
    }
@@ -933,20 +933,18 @@ uint32_t Layer::setTransactionFlags(uint32_t flags) {
}

bool Layer::setPosition(float x, float y) {
    if (mCurrentState.requested_legacy.transform.tx() == x &&
        mCurrentState.requested_legacy.transform.ty() == y)
        return false;
    if (mCurrentState.transform.tx() == x && mCurrentState.transform.ty() == y) return false;
    mCurrentState.sequence++;

    // We update the requested and active position simultaneously because
    // we want to apply the position portion of the transform matrix immediately,
    // but still delay scaling when resizing a SCALING_MODE_FREEZE layer.
    mCurrentState.requested_legacy.transform.set(x, y);
    mCurrentState.transform.set(x, y);
    // Here we directly update the active state
    // unlike other setters, because we store it within
    // the transform, but use different latching rules.
    // b/38182305
    mCurrentState.active_legacy.transform.set(x, y);
    mCurrentState.transform.set(x, y);

    mCurrentState.modified = true;
    setTransactionFlags(eTransactionNeeded);
@@ -1065,6 +1063,7 @@ bool Layer::setSize(uint32_t w, uint32_t h) {
    setDefaultBufferSize(mCurrentState.requested_legacy.w, mCurrentState.requested_legacy.h);
    return true;
}

bool Layer::setAlpha(float alpha) {
    if (mCurrentState.color.a == alpha) return false;
    mCurrentState.sequence++;
@@ -1143,8 +1142,7 @@ bool Layer::setMatrix(const layer_state_t::matrix22_t& matrix,
        return false;
    }
    mCurrentState.sequence++;
    mCurrentState.requested_legacy.transform.set(matrix.dsdx, matrix.dtdy, matrix.dtdx,
                                                 matrix.dsdy);
    mCurrentState.transform.set(matrix.dsdx, matrix.dtdy, matrix.dtdx, matrix.dsdy);
    mCurrentState.modified = true;
    setTransactionFlags(eTransactionNeeded);
    return true;
@@ -1560,20 +1558,20 @@ LayerDebugInfo Layer::getLayerDebugInfo(const DisplayDevice* display) const {
    info.mVisibleRegion = getVisibleRegion(display);
    info.mSurfaceDamageRegion = surfaceDamageRegion;
    info.mLayerStack = getLayerStack();
    info.mX = ds.active_legacy.transform.tx();
    info.mY = ds.active_legacy.transform.ty();
    info.mX = ds.transform.tx();
    info.mY = ds.transform.ty();
    info.mZ = ds.z;
    info.mWidth = ds.active_legacy.w;
    info.mHeight = ds.active_legacy.h;
    info.mWidth = ds.width;
    info.mHeight = ds.height;
    info.mCrop = ds.crop;
    info.mColor = ds.color;
    info.mFlags = ds.flags;
    info.mPixelFormat = getPixelFormat();
    info.mDataSpace = static_cast<android_dataspace>(getDataSpace());
    info.mMatrix[0][0] = ds.active_legacy.transform[0][0];
    info.mMatrix[0][1] = ds.active_legacy.transform[0][1];
    info.mMatrix[1][0] = ds.active_legacy.transform[1][0];
    info.mMatrix[1][1] = ds.active_legacy.transform[1][1];
    info.mMatrix[0][0] = ds.transform[0][0];
    info.mMatrix[0][1] = ds.transform[0][1];
    info.mMatrix[1][0] = ds.transform[1][0];
    info.mMatrix[1][1] = ds.transform[1][1];
    {
        sp<const GraphicBuffer> buffer = getBuffer();
        if (buffer != 0) {
+3 −6
Original line number Diff line number Diff line
@@ -484,12 +484,9 @@ public:
    // to avoid grabbing the lock again to avoid deadlock
    virtual bool isCreatedFromMainThread() const { return false; }

    virtual Geometry getActiveGeometry(const Layer::State& s) const { return s.active_legacy; }
    virtual uint32_t getActiveWidth(const Layer::State& s) const { return s.active_legacy.w; }
    virtual uint32_t getActiveHeight(const Layer::State& s) const { return s.active_legacy.h; }
    virtual ui::Transform getActiveTransform(const Layer::State& s) const {
        return s.active_legacy.transform;
    }
    uint32_t getActiveWidth(const Layer::State& s) const { return s.width; }
    uint32_t getActiveHeight(const Layer::State& s) const { return s.height; }
    ui::Transform getActiveTransform(const Layer::State& s) const { return s.transform; }
    virtual Region getActiveTransparentRegion(const Layer::State& s) const {
        return s.activeTransparentRegion_legacy;
    }
+2 −2
Original line number Diff line number Diff line
@@ -130,8 +130,8 @@ void SurfaceInterceptor::addInitialSurfaceStateLocked(Increment* increment,
    transaction->set_animation(layerFlags & BnSurfaceComposer::eAnimation);

    const int32_t layerId(getLayerId(layer));
    addPositionLocked(transaction, layerId, layer->mCurrentState.active_legacy.transform.tx(),
                      layer->mCurrentState.active_legacy.transform.ty());
    addPositionLocked(transaction, layerId, layer->mCurrentState.transform.tx(),
                      layer->mCurrentState.transform.ty());
    addDepthLocked(transaction, layerId, layer->mCurrentState.z);
    addAlphaLocked(transaction, layerId, layer->mCurrentState.color.a);
    addTransparentRegionLocked(transaction, layerId,