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

Commit ef27453c authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Cleanup attachFunctor"

parents 4f0128fb 832b1514
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -264,27 +264,6 @@ class GLES20Canvas extends HardwareCanvas {

    private static native int nCallDrawGLFunction(long renderer, long drawGLFunction);

    @Override
    public int invokeFunctors(Rect dirty) {
        return nInvokeFunctors(mRenderer, dirty);
    }

    private static native int nInvokeFunctors(long renderer, Rect dirty);

    @Override
    public void detachFunctor(long functor) {
        nDetachFunctor(mRenderer, functor);
    }

    private static native void nDetachFunctor(long renderer, long functor);

    @Override
    public void attachFunctor(long functor) {
        nAttachFunctor(mRenderer, functor);
    }

    private static native void nAttachFunctor(long renderer, long functor);

    ///////////////////////////////////////////////////////////////////////////
    // Memory
    ///////////////////////////////////////////////////////////////////////////
+0 −34
Original line number Diff line number Diff line
@@ -168,7 +168,6 @@ public class GLRenderer extends HardwareRenderer {
    private final Rect mRedrawClip = new Rect();

    private final int[] mSurfaceSize = new int[2];
    private final FunctorsRunnable mFunctorsRunnable = new FunctorsRunnable();

    private long mDrawDelta = Long.MAX_VALUE;

@@ -1121,22 +1120,6 @@ public class GLRenderer extends HardwareRenderer {
        mName = name;
    }

    class FunctorsRunnable implements Runnable {
        View.AttachInfo attachInfo;

        @Override
        public void run() {
            final HardwareRenderer renderer = attachInfo.mHardwareRenderer;
            if (renderer == null || !renderer.isEnabled() || renderer != GLRenderer.this) {
                return;
            }

            if (checkRenderContext() != SURFACE_STATE_ERROR) {
                mCanvas.invokeFunctors(mRedrawClip);
            }
        }
    }

    @Override
    void draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks,
            Rect dirty) {
@@ -1371,23 +1354,6 @@ public class GLRenderer extends HardwareRenderer {
        }
    }

    @Override
    void detachFunctor(long functor) {
        if (mCanvas != null) {
            mCanvas.detachFunctor(functor);
        }
    }

    @Override
    void attachFunctor(View.AttachInfo attachInfo, long functor) {
        if (mCanvas != null) {
            mCanvas.attachFunctor(functor);
            mFunctorsRunnable.attachInfo = attachInfo;
            attachInfo.mHandler.removeCallbacks(mFunctorsRunnable);
            attachInfo.mHandler.postDelayed(mFunctorsRunnable,  0);
        }
    }

    /**
     * Ensures the current EGL context and surface are the ones we expect.
     * This method throws an IllegalStateException if invoked from a thread
+0 −39
Original line number Diff line number Diff line
@@ -110,45 +110,6 @@ public abstract class HardwareCanvas extends Canvas {
        return RenderNode.STATUS_DONE;
    }

    /**
     * Invoke all the functors who requested to be invoked during the previous frame.
     *
     * @param dirty Ignored
     *
     * @return Ignored
     *
     * @hide
     */
    public int invokeFunctors(Rect dirty) {
        return RenderNode.STATUS_DONE;
    }

    /**
     * Detaches the specified functor from the current functor execution queue.
     *
     * @param functor The native functor to remove from the execution queue.
     *
     * @see #invokeFunctors(android.graphics.Rect)
     * @see #callDrawGLFunction(long)
     * @see #detachFunctor(long)
     *
     * @hide
     */
    abstract void detachFunctor(long functor);

    /**
     * Attaches the specified functor to the current functor execution queue.
     *
     * @param functor The native functor to add to the execution queue.
     *
     * @see #invokeFunctors(android.graphics.Rect)
     * @see #callDrawGLFunction(long)
     * @see #detachFunctor(long)
     *
     * @hide
     */
    abstract void attachFunctor(long functor);

    /**
     * Indicates that the specified layer must be updated as soon as possible.
     *
+0 −22
Original line number Diff line number Diff line
@@ -422,28 +422,6 @@ public abstract class HardwareRenderer {

    abstract boolean copyLayerInto(HardwareLayer layer, Bitmap bitmap);

    /**
     * Detaches the specified functor from the current functor execution queue.
     *
     * @param functor The native functor to remove from the execution queue.
     *
     * @see HardwareCanvas#callDrawGLFunction(int)
     * @see #attachFunctor(android.view.View.AttachInfo, long)
     */
    abstract void detachFunctor(long functor);

    /**
     * Schedules the specified functor in the functors execution queue.
     *
     * @param attachInfo AttachInfo tied to this renderer.
     * @param functor The native functor to insert in the execution queue.
     *
     * @see HardwareCanvas#callDrawGLFunction(int)
     * @see #detachFunctor(long)
     *
     */
    abstract void attachFunctor(View.AttachInfo attachInfo, long functor);

    /**
     * Schedules the functor for execution in either kModeProcess or
     * kModeProcessNoContext, depending on whether or not there is an EGLContext.
+0 −10
Original line number Diff line number Diff line
@@ -219,16 +219,6 @@ public class ThreadedRenderer extends HardwareRenderer {
        }
    }

    @Override
    void detachFunctor(long functor) {
        // no-op, we never attach functors to need to detach them
    }

    @Override
    void attachFunctor(AttachInfo attachInfo, long functor) {
        invokeFunctor(functor, true);
    }

    @Override
    void invokeFunctor(long functor, boolean waitForCompletion) {
        nInvokeFunctor(mNativeProxy, functor, waitForCompletion);
Loading