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

Commit e4267ea4 authored by John Reck's avatar John Reck
Browse files

Even FASTER damage calculations!

 * Now with more native!
 * Less matrix math thanks to bulk-property-update support!
 * Zero JNI on the View.damageInParent() path!
 * Fully aware of RT-driven animators!
 * Likely full of new and exciting bugs!
 * But it also fixes at least 1 existing invalidate bug!

Change-Id: Ie0773f85a60850ff2668370c58defef2e8aa079f
parent 79c7de77
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -217,8 +217,6 @@ final class HardwareLayer {
    private static native void nUpdateRenderLayer(long layerUpdater, long displayList,
            int left, int top, int right, int bottom);

    private static native boolean nFlushChanges(long layerUpdater);

    private static native long nGetLayer(long layerUpdater);
    private static native int nGetTexName(long layerUpdater);
}
+1 −2
Original line number Diff line number Diff line
@@ -363,8 +363,7 @@ public abstract class HardwareRenderer {
     * @param callbacks Callbacks invoked when drawing happens.
     * @param dirty The dirty rectangle to update, can be null.
     */
    abstract void draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks,
            Rect dirty);
    abstract void draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks);

    /**
     * Creates a new hardware layer. A hardware layer built by calling this
+8 −0
Original line number Diff line number Diff line
@@ -841,6 +841,13 @@ public class RenderNode {
        return nOffsetTopAndBottom(mNativeRenderNode, offset);
    }

    /**
     * Sets the scroll position, this is used for damage calculations
     */
    public void setScrollPosition(int x, int y) {
        nSetScrollPosition(mNativeRenderNode, x, y);
    }

    /**
     * Outputs the display list to the log. This method exists for use by
     * tools to output display lists for selected nodes to the log.
@@ -899,6 +906,7 @@ public class RenderNode {
    private static native boolean nSetRight(long renderNode, int right);
    private static native boolean nSetTop(long renderNode, int top);
    private static native boolean nSetLeft(long renderNode, int left);
    private static native void nSetScrollPosition(long renderNode, int scrollX, int scrollY);
    private static native boolean nSetCameraDistance(long renderNode, float distance);
    private static native boolean nSetPivotY(long renderNode, float pivotY);
    private static native boolean nSetPivotX(long renderNode, float pivotX);
+3 −10
Original line number Diff line number Diff line
@@ -54,8 +54,6 @@ import java.io.PrintWriter;
public class ThreadedRenderer extends HardwareRenderer {
    private static final String LOGTAG = "ThreadedRenderer";

    private static final Rect NULL_RECT = new Rect();

    // Keep in sync with DrawFrameTask.h SYNC_* flags
    // Nothing interesting to report
    private static final int SYNC_OK = 0x0;
@@ -228,7 +226,7 @@ public class ThreadedRenderer extends HardwareRenderer {
    }

    @Override
    void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) {
    void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks) {
        attachInfo.mIgnoreDirtyState = true;
        long frameTimeNanos = mChoreographer.getFrameTimeNanos();
        attachInfo.mDrawingTime = frameTimeNanos / TimeUtils.NANOS_PER_MS;
@@ -246,12 +244,8 @@ public class ThreadedRenderer extends HardwareRenderer {

        attachInfo.mIgnoreDirtyState = false;

        if (dirty == null) {
            dirty = NULL_RECT;
        }
        int syncResult = nSyncAndDrawFrame(mNativeProxy, frameTimeNanos,
                recordDuration, view.getResources().getDisplayMetrics().density,
                dirty.left, dirty.top, dirty.right, dirty.bottom);
                recordDuration, view.getResources().getDisplayMetrics().density);
        if ((syncResult & SYNC_INVALIDATE_REQUIRED) != 0) {
            attachInfo.mViewRootImpl.invalidate();
        }
@@ -393,8 +387,7 @@ public class ThreadedRenderer extends HardwareRenderer {
            float lightX, float lightY, float lightZ, float lightRadius);
    private static native void nSetOpaque(long nativeProxy, boolean opaque);
    private static native int nSyncAndDrawFrame(long nativeProxy,
            long frameTimeNanos, long recordDuration, float density,
            int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom);
            long frameTimeNanos, long recordDuration, float density);
    private static native void nRunWithGlContext(long nativeProxy, Runnable runnable);
    private static native void nDestroyCanvasAndSurface(long nativeProxy);

+1 −0
Original line number Diff line number Diff line
@@ -13750,6 +13750,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            return;
        }
        renderNode.setScrollPosition(mScrollX, mScrollY);
        if ((mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == 0
                || !renderNode.isValid()
                || (!isLayer && mRecreateDisplayList)) {
Loading