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

Commit c724e6ba authored by Surbhi Kadam's avatar Surbhi Kadam Committed by Android (Google) Code Review
Browse files

Merge "Add support for setting per-corner radius in SurfaceFlinger" into main

parents 8423741c a6bc4854
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -105,11 +105,13 @@ filegroup {
    srcs: [
        "android/gui/BorderSettings.aidl",
        "android/gui/BoxShadowSettings.aidl",
        "android/gui/CornerRadiiData.aidl",
        "android/gui/DropInputMode.aidl",
        "android/gui/EarlyWakeupInfo.aidl",
        "android/gui/StalledTransactionInfo.aidl",
        "android/**/TouchOcclusionMode.aidl",
        "android/gui/TrustedOverlay.aidl",
        "android/gui/Vec2.aidl",
    ],
}

+10 −10
Original line number Diff line number Diff line
@@ -87,8 +87,8 @@ layer_state_t::layer_state_t()
        flags(0),
        mask(0),
        reserved(0),
        cornerRadius(0.0f),
        clientDrawnCornerRadius(0.0f),
        cornerRadii(gui::CornerRadii(0.0f)),
        clientDrawnCornerRadii(gui::CornerRadii(0.0f)),
        backgroundBlurRadius(0),
        backgroundBlurScale{1.0f},
        color(0),
@@ -164,8 +164,8 @@ status_t layer_state_t::write(Parcel& output) const
    }

    SAFE_PARCEL(output.write, colorTransform.asArray(), 16 * sizeof(float));
    SAFE_PARCEL(output.writeFloat, cornerRadius);
    SAFE_PARCEL(output.writeFloat, clientDrawnCornerRadius);
    SAFE_PARCEL(cornerRadii.writeToParcel, &output);
    SAFE_PARCEL(clientDrawnCornerRadii.writeToParcel, &output);
    SAFE_PARCEL(output.writeUint32, backgroundBlurRadius);
    SAFE_PARCEL(output.writeFloat, backgroundBlurScale);
    SAFE_PARCEL(output.writeParcelable, metadata);
@@ -305,8 +305,8 @@ status_t layer_state_t::read(const Parcel& input)
    }

    SAFE_PARCEL(input.read, &colorTransform, 16 * sizeof(float));
    SAFE_PARCEL(input.readFloat, &cornerRadius);
    SAFE_PARCEL(input.readFloat, &clientDrawnCornerRadius);
    SAFE_PARCEL(cornerRadii.readFromParcel, &input);
    SAFE_PARCEL(clientDrawnCornerRadii.readFromParcel, &input);
    SAFE_PARCEL(input.readUint32, &backgroundBlurRadius);
    SAFE_PARCEL(input.readFloat, &backgroundBlurScale);
    SAFE_PARCEL(input.readParcelable, &metadata);
@@ -634,11 +634,11 @@ void layer_state_t::merge(const layer_state_t& other) {
    }
    if (other.what & eCornerRadiusChanged) {
        what |= eCornerRadiusChanged;
        cornerRadius = other.cornerRadius;
        cornerRadii = other.cornerRadii;
    }
    if (other.what & eClientDrawnCornerRadiusChanged) {
        what |= eClientDrawnCornerRadiusChanged;
        clientDrawnCornerRadius = other.clientDrawnCornerRadius;
        clientDrawnCornerRadii = other.clientDrawnCornerRadii;
    }
    if (other.what & eBackgroundBlurRadiusChanged) {
        what |= eBackgroundBlurRadiusChanged;
@@ -868,8 +868,8 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const {
        if (changedFlags) diff |= eFlagsChanged;
    }
    CHECK_DIFF(diff, eLayerStackChanged, other, layerStack);
    CHECK_DIFF(diff, eCornerRadiusChanged, other, cornerRadius);
    CHECK_DIFF(diff, eClientDrawnCornerRadiusChanged, other, clientDrawnCornerRadius);
    CHECK_DIFF(diff, eCornerRadiusChanged, other, cornerRadii);
    CHECK_DIFF(diff, eClientDrawnCornerRadiusChanged, other, clientDrawnCornerRadii);
    CHECK_DIFF(diff, eBackgroundBlurRadiusChanged, other, backgroundBlurRadius);
    CHECK_DIFF(diff, eBackgroundBlurScaleChanged, other, backgroundBlurScale);
    if (other.what & eBlurRegionsChanged) diff |= eBlurRegionsChanged;
+12 −2
Original line number Diff line number Diff line
@@ -1549,25 +1549,35 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setCrop(

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setCornerRadius(
        const sp<SurfaceControl>& sc, float cornerRadius) {
    return setCornerRadius(sc, gui::CornerRadii(cornerRadius));
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setCornerRadius(
        const sp<SurfaceControl>& sc, const gui::CornerRadii& radii) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }
    s->what |= layer_state_t::eCornerRadiusChanged;
    s->cornerRadius = cornerRadius;
    s->cornerRadii = radii;
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setClientDrawnCornerRadius(
        const sp<SurfaceControl>& sc, float clientDrawnCornerRadius) {
    return setClientDrawnCornerRadius(sc, gui::CornerRadii(clientDrawnCornerRadius));
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setClientDrawnCornerRadius(
        const sp<SurfaceControl>& sc, const gui::CornerRadii& radii) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }
    s->what |= layer_state_t::eClientDrawnCornerRadiusChanged;
    s->clientDrawnCornerRadius = clientDrawnCornerRadius;
    s->clientDrawnCornerRadii = radii;
    return *this;
}

+28 −0
Original line number Diff line number Diff line
/*
 * Copyright 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.gui;


import android.gui.Vec2;

/** @hide */
parcelable CornerRadiiData {
    Vec2 topLeft;
    Vec2 topRight;
    Vec2 bottomLeft;
    Vec2 bottomRight;
}
+23 −0
Original line number Diff line number Diff line
/*
 * Copyright 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.gui;

/** @hide */
parcelable Vec2 {
    float x;
    float y;
}
Loading