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

Commit 9014b31f authored by Deepanshu Gupta's avatar Deepanshu Gupta Committed by Android Git Automerger
Browse files

am 8381e2cd: Merge "Fix view outline for shadows in LayoutLib." into mnc-dev

* commit '8381e2cd':
  Fix view outline for shadows in LayoutLib.
parents 33d77e18 8381e2cd
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -15778,11 +15778,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            return;
        }
        if (mBackgroundSizeChanged) {
            background.setBounds(0, 0,  mRight - mLeft, mBottom - mTop);
            mBackgroundSizeChanged = false;
            rebuildOutline();
        }
        setBackgroundBounds();
        // Attempt to use a display list if requested.
        if (canvas.isHardwareAccelerated() && mAttachInfo != null
@@ -15808,6 +15804,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /**
     * Sets the correct background bounds and rebuilds the outline, if needed.
     * <p/>
     * This is called by LayoutLib.
     */
    void setBackgroundBounds() {
        if (mBackgroundSizeChanged && mBackground != null) {
            mBackground.setBounds(0, 0,  mRight - mLeft, mBottom - mTop);
            mBackgroundSizeChanged = false;
            rebuildOutline();
        }
    }
    private void setBackgroundRenderNodeProperties(RenderNode renderNode) {
        renderNode.setTranslationX(mScrollX);
        renderNode.setTranslationY(mScrollY);
+5 −2
Original line number Diff line number Diff line
@@ -220,7 +220,8 @@ public final class Canvas_Delegate {
    }

    @LayoutlibDelegate
    /*package*/ static void native_restore(long nativeCanvas) {
    /*package*/ static void native_restore(long nativeCanvas, boolean throwOnUnderflow) {
        // FIXME: implement throwOnUnderflow.
        // get the delegate from the native int.
        Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
        if (canvasDelegate == null) {
@@ -231,7 +232,9 @@ public final class Canvas_Delegate {
    }

    @LayoutlibDelegate
    /*package*/ static void native_restoreToCount(long nativeCanvas, int saveCount) {
    /*package*/ static void native_restoreToCount(long nativeCanvas, int saveCount,
            boolean throwOnUnderflow) {
        // FIXME: implement throwOnUnderflow.
        // get the delegate from the native int.
        Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
        if (canvasDelegate == null) {
+4 −8
Original line number Diff line number Diff line
@@ -46,16 +46,12 @@ public class ViewGroup_Delegate {
    /*package*/ static boolean drawChild(ViewGroup thisVG, Canvas canvas, View child,
            long drawingTime) {
        if (child.getZ() > thisVG.getZ()) {
            // The background's bounds are set lazily. Make sure they are set correctly so that
            // the outline obtained is correct.
            child.setBackgroundBounds();
            ViewOutlineProvider outlineProvider = child.getOutlineProvider();
            Outline outline = new Outline();
            Outline outline = child.mAttachInfo.mTmpOutline;
            outlineProvider.getOutline(child, outline);
            if (outline.mPath == null && outline.mRect == null) {
                // Sometimes, the bounds of the background drawable are not set until View.draw()
                // is called. So, we set the bounds manually and try to get the outline again.
                child.getBackground().setBounds(0, 0, child.mRight - child.mLeft,
                        child.mBottom - child.mTop);
                outlineProvider.getOutline(child, outline);
            }
            if (outline.mPath != null || (outline.mRect != null && !outline.mRect.isEmpty())) {
                int restoreTo = transformCanvas(thisVG, canvas, child);
                drawShadow(thisVG, canvas, child, outline);