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

Commit 83eb4302 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Add shadow/clipping properties to HierarchyViewer" into lmp-dev

parents 624a205e 5c75c52e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -367,6 +367,10 @@ public class RenderNode {
        throw new IllegalArgumentException("Unrecognized outline?");
    }

    public boolean hasShadow() {
        return nHasShadow(mNativeRenderNode);
    }

    /**
     * Enables or disables clipping to the outline.
     *
@@ -861,6 +865,7 @@ public class RenderNode {
            float alpha);
    private static native boolean nSetOutlineEmpty(long renderNode);
    private static native boolean nSetOutlineNone(long renderNode);
    private static native boolean nHasShadow(long renderNode);
    private static native boolean nSetClipToOutline(long renderNode, boolean clipToOutline);
    private static native boolean nSetRevealClip(long renderNode,
            boolean shouldClip, float x, float y, float radius);
+12 −0
Original line number Diff line number Diff line
@@ -10224,6 +10224,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @return true if the content in this view might overlap, false otherwise.
     */
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean hasOverlappingRendering() {
        return true;
    }
@@ -10926,6 +10927,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        invalidateViewProperty(false, false);
    }
    /**
     * HierarchyViewer only
     *
     * @hide
     */
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean hasShadow() {
        return mRenderNode.hasShadow();
    }
    /** @hide */
    public void setRevealClip(boolean shouldClip, float x, float y, float radius) {
        mRenderNode.setRevealClip(shouldClip, x, y, radius);
+2 −0
Original line number Diff line number Diff line
@@ -3301,6 +3301,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * @return True if the group's children will be clipped to their bounds,
     * false otherwise.
     */
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean getClipChildren() {
        return ((mGroupFlags & FLAG_CLIP_CHILDREN) != 0);
    }
@@ -3349,6 +3350,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     *
     * @attr ref android.R.styleable#ViewGroup_clipToPadding
     */
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean getClipToPadding() {
        return hasBooleanFlag(FLAG_CLIP_TO_PADDING);
    }
+7 −0
Original line number Diff line number Diff line
@@ -173,6 +173,12 @@ static jboolean android_view_RenderNode_setOutlineNone(JNIEnv* env,
    return true;
}

static jboolean android_view_RenderNode_hasShadow(JNIEnv* env,
        jobject clazz, jlong renderNodePtr) {
    RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr);
    return renderNode->stagingProperties().hasShadow();
}

static jboolean android_view_RenderNode_setClipToOutline(JNIEnv* env,
        jobject clazz, jlong renderNodePtr, jboolean clipToOutline) {
    RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr);
@@ -491,6 +497,7 @@ static JNINativeMethod gMethods[] = {
    { "nSetOutlineConvexPath", "(JJF)Z", (void*) android_view_RenderNode_setOutlineConvexPath },
    { "nSetOutlineEmpty",      "(J)Z",   (void*) android_view_RenderNode_setOutlineEmpty },
    { "nSetOutlineNone",       "(J)Z",   (void*) android_view_RenderNode_setOutlineNone },
    { "nHasShadow",            "(J)Z",   (void*) android_view_RenderNode_hasShadow },
    { "nSetClipToOutline",     "(JZ)Z",  (void*) android_view_RenderNode_setClipToOutline },
    { "nSetRevealClip",        "(JZFFF)Z", (void*) android_view_RenderNode_setRevealClip },

+4 −0
Original line number Diff line number Diff line
@@ -569,6 +569,10 @@ public:
        return getClipToBounds() && (getZ() <= 0 || getOutline().isEmpty());
    }

    bool hasShadow() const {
        return getZ() >= 0.0f && getOutline().getPath() != NULL;
    }

private:
    // Rendering properties
    struct PrimitiveFields {