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

Commit 7956695e authored by Peiyong Lin's avatar Peiyong Lin
Browse files

[RoundedCorner] Use the correct source bounds and crop.

Previously we call getBounds to calculate the rounded corner, but that's wrong.
For an app layer, what we really need is the source bounds of the layer, and
the actual crop with transformation but without any parent bounds and display
bounds. However, only the root view has the correct crop information. And thus
this patch passes the correct bounds up to the root, and use the crop from the
root to calculate the rounded corner bounds.

BUG: 125916918
Test: Build, flash and boot. Verify with window transition.
Change-Id: I6c1b92a2c684da956b284b190e8b8a1b45494140
parent 6b243887
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1768,9 +1768,13 @@ half4 Layer::getColor() const {
}

Layer::RoundedCornerState Layer::getRoundedCornerState() const {
    return getRoundedCornerStateInternal(mSourceBounds);
}

Layer::RoundedCornerState Layer::getRoundedCornerStateInternal(const FloatRect bounds) const {
    const auto& p = mDrawingParent.promote();
    if (p != nullptr) {
        RoundedCornerState parentState = p->getRoundedCornerState();
        RoundedCornerState parentState = p->getRoundedCornerStateInternal(bounds);
        if (parentState.radius > 0) {
            ui::Transform t = getActiveTransform(getDrawingState());
            t = t.inverse();
@@ -1784,7 +1788,9 @@ Layer::RoundedCornerState Layer::getRoundedCornerState() const {
        }
    }
    const float radius = getDrawingState().cornerRadius;
    return radius > 0 ? RoundedCornerState(getBounds(), radius) : RoundedCornerState();
    return radius > 0
            ? RoundedCornerState(bounds.intersect(getCrop(getDrawingState()).toFloatRect()), radius)
            : RoundedCornerState();
}

void Layer::commitChildList() {
+2 −0
Original line number Diff line number Diff line
@@ -901,6 +901,8 @@ private:
     */
    Rect getCroppedBufferSize(const Layer::State& s) const;

    RoundedCornerState getRoundedCornerStateInternal(const FloatRect bounds) const;

    // Cached properties computed from drawing state
    // Effective transform taking into account parent transforms and any parent scaling.
    ui::Transform mEffectiveTransform;