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

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

Merge "Simplify width, height, transform variable for BSL" into sc-dev

parents 870da004 766c9c53
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -257,8 +257,8 @@ Rect BufferStateLayer::getCrop(const Layer::State& /*s*/) const {
}

bool BufferStateLayer::setTransform(uint32_t transform) {
    if (mCurrentState.transform == transform) return false;
    mCurrentState.transform = transform;
    if (mCurrentState.bufferTransform == transform) return false;
    mCurrentState.bufferTransform = transform;
    mCurrentState.modified = true;
    setTransactionFlags(eTransactionNeeded);
    return true;
@@ -310,17 +310,17 @@ bool BufferStateLayer::setFrame(const Rect& frame) {
        h = frame.bottom;
    }

    if (mCurrentState.active.transform.tx() == x && mCurrentState.active.transform.ty() == y &&
        mCurrentState.active.w == w && mCurrentState.active.h == h) {
    if (mCurrentState.transform.tx() == x && mCurrentState.transform.ty() == y &&
        mCurrentState.width == w && mCurrentState.height == h) {
        return false;
    }

    if (!frame.isValid()) {
        x = y = w = h = 0;
    }
    mCurrentState.active.transform.set(x, y);
    mCurrentState.active.w = w;
    mCurrentState.active.h = h;
    mCurrentState.transform.set(x, y);
    mCurrentState.width = w;
    mCurrentState.height = h;

    mCurrentState.sequence++;
    mCurrentState.modified = true;
@@ -781,7 +781,7 @@ void BufferStateLayer::gatherBufferInfo() {
    mBufferInfo.mDesiredPresentTime = s.desiredPresentTime;
    mBufferInfo.mFenceTime = std::make_shared<FenceTime>(s.acquireFence);
    mBufferInfo.mFence = s.acquireFence;
    mBufferInfo.mTransform = s.transform;
    mBufferInfo.mTransform = s.bufferTransform;
    mBufferInfo.mDataspace = translateDataspace(s.dataspace);
    mBufferInfo.mCrop = computeCrop(s);
    mBufferInfo.mScaleMode = NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW;
@@ -848,10 +848,10 @@ Layer::RoundedCornerState BufferStateLayer::getRoundedCornerState() const {
    const State& s(getDrawingState());
    if (radius <= 0 || (getActiveWidth(s) == UINT32_MAX && getActiveHeight(s) == UINT32_MAX))
        return RoundedCornerState();
    return RoundedCornerState(FloatRect(static_cast<float>(s.active.transform.tx()),
                                        static_cast<float>(s.active.transform.ty()),
                                        static_cast<float>(s.active.transform.tx() + s.active.w),
                                        static_cast<float>(s.active.transform.ty() + s.active.h)),
    return RoundedCornerState(FloatRect(static_cast<float>(s.transform.tx()),
                                        static_cast<float>(s.transform.ty()),
                                        static_cast<float>(s.transform.tx() + s.width),
                                        static_cast<float>(s.transform.ty() + s.height)),
                              radius);
}

@@ -865,7 +865,7 @@ bool BufferStateLayer::bufferNeedsFiltering() const {
    uint32_t bufferHeight = s.buffer->height;

    // Undo any transformations on the buffer and return the result.
    if (s.transform & ui::Transform::ROT_90) {
    if (s.bufferTransform & ui::Transform::ROT_90) {
        std::swap(bufferWidth, bufferHeight);
    }

+3 −5
Original line number Diff line number Diff line
@@ -55,11 +55,9 @@ public:
    void pushPendingState() override;*/
    bool applyPendingStates(Layer::State* stateToCommit) override;

    uint32_t getActiveWidth(const Layer::State& s) const override { return s.active.w; }
    uint32_t getActiveHeight(const Layer::State& s) const override { return s.active.h; }
    ui::Transform getActiveTransform(const Layer::State& s) const override {
        return s.active.transform;
    }
    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;
    }
+7 −8
Original line number Diff line number Diff line
@@ -109,11 +109,11 @@ Layer::Layer(const LayerCreationArgs& args)
    mCurrentState.layerStack = 0;
    mCurrentState.sequence = 0;
    mCurrentState.requested_legacy = mCurrentState.active_legacy;
    mCurrentState.active.w = UINT32_MAX;
    mCurrentState.active.h = UINT32_MAX;
    mCurrentState.active.transform.set(0, 0);
    mCurrentState.width = UINT32_MAX;
    mCurrentState.height = UINT32_MAX;
    mCurrentState.transform.set(0, 0);
    mCurrentState.frameNumber = 0;
    mCurrentState.transform = 0;
    mCurrentState.bufferTransform = 0;
    mCurrentState.transformToDisplayInverse = false;
    mCurrentState.crop.makeInvalid();
    mCurrentState.acquireFence = new Fence(-1);
@@ -2443,7 +2443,7 @@ void Layer::writeToProtoCommonState(LayerProto* layerInfo, LayerVector::StateSet
    const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren;
    const State& state = useDrawing ? mDrawingState : mCurrentState;

    ui::Transform requestedTransform = state.active_legacy.transform;
    ui::Transform requestedTransform = state.transform;

    if (traceFlags & SurfaceTracing::TRACE_CRITICAL) {
        layerInfo->set_id(sequence);
@@ -2472,11 +2472,10 @@ void Layer::writeToProtoCommonState(LayerProto* layerInfo, LayerVector::StateSet
                                                   return layerInfo->mutable_requested_position();
                                               });

        LayerProtoHelper::writeSizeToProto(state.active_legacy.w, state.active_legacy.h,
        LayerProtoHelper::writeSizeToProto(state.width, state.height,
                                           [&]() { return layerInfo->mutable_size(); });

        LayerProtoHelper::writeToProto(state.crop_legacy,
                                       [&]() { return layerInfo->mutable_crop(); });
        LayerProtoHelper::writeToProto(state.crop, [&]() { return layerInfo->mutable_crop(); });

        layerInfo->set_is_opaque(isOpaque(state));

+4 −2
Original line number Diff line number Diff line
@@ -250,9 +250,11 @@ public:

        // The fields below this point are only used by BufferStateLayer
        uint64_t frameNumber;
        Geometry active;
        uint32_t width;
        uint32_t height;
        ui::Transform transform;

        uint32_t transform;
        uint32_t bufferTransform;
        bool transformToDisplayInverse;

        Rect crop;
+2 −2
Original line number Diff line number Diff line
@@ -836,8 +836,8 @@ struct BaseLayerVariant {
    static void initLayerDrawingStateAndComputeBounds(CompositionTest* test, sp<L> layer) {
        auto& layerDrawingState = test->mFlinger.mutableLayerDrawingState(layer);
        layerDrawingState.layerStack = DEFAULT_LAYER_STACK;
        layerDrawingState.active.w = 100;
        layerDrawingState.active.h = 100;
        layerDrawingState.width = 100;
        layerDrawingState.height = 100;
        layerDrawingState.color = half4(LayerProperties::COLOR[0], LayerProperties::COLOR[1],
                                        LayerProperties::COLOR[2], LayerProperties::COLOR[3]);
        layer->computeBounds(FloatRect(0, 0, 100, 100), ui::Transform(), 0.f /* shadowRadius */);