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

Commit b024aaa9 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Ensure surfaces with insets aren't rendered as opaque" into lmp-dev

parents d44a5b35 57774a82
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -81,6 +81,9 @@ public class ThreadedRenderer extends HardwareRenderer {
    // applied as translation when updating the root render node.
    private int mInsetTop, mInsetLeft;

    // Whether the surface has insets. Used to protect opacity.
    private boolean mHasInsets;

    // Light and shadow properties specified by the theme.
    private final float mLightY;
    private final float mLightZ;
@@ -187,12 +190,17 @@ public class ThreadedRenderer extends HardwareRenderer {
        final float lightX = width / 2.0f;
        mWidth = width;
        mHeight = height;
        if (surfaceInsets != null) {
        if (surfaceInsets != null && !surfaceInsets.isEmpty()) {
            mHasInsets = true;
            mInsetLeft = surfaceInsets.left;
            mInsetTop = surfaceInsets.top;
            mSurfaceWidth = width + mInsetLeft + surfaceInsets.right;
            mSurfaceHeight = height + mInsetTop + surfaceInsets.bottom;

            // If the surface has insets, it can't be opaque.
            setOpaque(false);
        } else {
            mHasInsets = false;
            mInsetLeft = 0;
            mInsetTop = 0;
            mSurfaceWidth = width;
@@ -204,7 +212,7 @@ public class ThreadedRenderer extends HardwareRenderer {

    @Override
    void setOpaque(boolean opaque) {
        nSetOpaque(mNativeProxy, opaque);
        nSetOpaque(mNativeProxy, opaque && !mHasInsets);
    }

    @Override