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

Commit 4c51b7c0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Tweak some RenderNode API surfaces"

parents 37200f96 568b2a64
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -47,8 +47,7 @@ public class RenderNodePerfTest {
    public void testCreateRenderNodeNoName() {
        final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        while (state.keepRunning()) {
            RenderNode node = RenderNode.create(null, null);
            node.destroy();
            RenderNode.create(null, null);
        }
    }

@@ -56,8 +55,7 @@ public class RenderNodePerfTest {
    public void testCreateRenderNode() {
        final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        while (state.keepRunning()) {
            RenderNode node = RenderNode.create("LinearLayout", null);
            node.destroy();
            RenderNode.create("LinearLayout", null);
        }
    }

+2 −3
Original line number Diff line number Diff line
@@ -180,13 +180,12 @@ public final class DisplayListCanvas extends RecordingCanvas {
    ///////////////////////////////////////////////////////////////////////////

    /**
     * Draws the specified display list onto this canvas. The display list can only
     * be drawn if {@link android.view.RenderNode#isValid()} returns true.
     * Draws the specified display list onto this canvas.
     *
     * @param renderNode The RenderNode to draw.
     */
    public void drawRenderNode(RenderNode renderNode) {
        nDrawRenderNode(mNativeCanvasWrapper, renderNode.getNativeDisplayList());
        nDrawRenderNode(mNativeCanvasWrapper, renderNode.mNativeRenderNode);
    }

    ///////////////////////////////////////////////////////////////////////////
+15 −18
Original line number Diff line number Diff line
@@ -139,7 +139,9 @@ public class RenderNode {
                RenderNode.class.getClassLoader(), nGetNativeFinalizer(), 1024);
    }

    // Do not access directly unless you are ThreadedRenderer
    /** Not for general use; use only if you are ThreadedRenderer or DisplayListCanvas.
     * @hide
     */
    final long mNativeRenderNode;
    private final View mOwningView;

@@ -158,15 +160,6 @@ public class RenderNode {
        mOwningView = null;
    }

    /**
     * Immediately destroys the RenderNode
     * Only suitable for testing/benchmarking where waiting for the GC/finalizer
     * is not feasible.
     */
    public void destroy() {
        // TODO: Removed temporarily
    }

    /**
     * Creates a new RenderNode that can be used to record batches of
     * drawing operations, and store / apply render properties when drawn.
@@ -218,6 +211,14 @@ public class RenderNode {
        return DisplayListCanvas.obtain(this, width, height);
    }

    /**
     * Same as {@link #start(int, int)} but with the RenderNode's width & height
     */
    public DisplayListCanvas start() {
        return DisplayListCanvas.obtain(this,
                nGetWidth(mNativeRenderNode), nGetHeight(mNativeRenderNode));
    }

    /**
     * Ends the recording for this display list. A display list cannot be
     * replayed if recording is not finished. Calling this method marks
@@ -251,13 +252,6 @@ public class RenderNode {
        return nIsValid(mNativeRenderNode);
    }

    long getNativeDisplayList() {
        if (!isValid()) {
            throw new IllegalStateException("The display list is not valid.");
        }
        return mNativeRenderNode;
    }

    ///////////////////////////////////////////////////////////////////////////
    // Matrix manipulation
    ///////////////////////////////////////////////////////////////////////////
@@ -463,7 +457,6 @@ public class RenderNode {
     * @see #setHasOverlappingRendering(boolean)
     */
    public boolean hasOverlappingRendering() {
        //noinspection SimplifiableIfStatement
        return nHasOverlappingRendering(mNativeRenderNode);
    }

@@ -1009,4 +1002,8 @@ public class RenderNode {
    private static native float nGetPivotX(long renderNode);
    @CriticalNative
    private static native float nGetPivotY(long renderNode);
    @CriticalNative
    private static native int nGetWidth(long renderNode);
    @CriticalNative
    private static native int nGetHeight(long renderNode);
}
+4 −2
Original line number Diff line number Diff line
@@ -850,7 +850,9 @@ public final class ThreadedRenderer {


    void buildLayer(RenderNode node) {
        nBuildLayer(mNativeProxy, node.getNativeDisplayList());
        if (node.isValid()) {
            nBuildLayer(mNativeProxy, node.mNativeRenderNode);
        }
    }


@@ -928,7 +930,7 @@ public final class ThreadedRenderer {
     * not the RenderNode from a View.
     **/
    public static Bitmap createHardwareBitmap(RenderNode node, int width, int height) {
        return nCreateHardwareBitmap(node.getNativeDisplayList(), width, height);
        return nCreateHardwareBitmap(node.mNativeRenderNode, width, height);
    }

    /**
+0 −1
Original line number Diff line number Diff line
@@ -531,7 +531,6 @@ public class ViewDebug {
            throws IOException {
        RenderNode node = RenderNode.create("ViewDebug", null);
        profileViewAndChildren(view, node, out, true);
        node.destroy();
    }

    private static void profileViewAndChildren(View view, RenderNode node, BufferedWriter out,
Loading