Gather command and node region information off the UI thread.

Summary: This optimizes node region searches in clipping cases, and does position calculation for drawCommands off of the UI thread.

Reviewed By: ahmedre

Differential Revision: D3665301
This commit is contained in:
Seth Kirby
2016-08-08 16:05:36 -07:00
committed by Ahmed El-Helw
parent ca79e6cf30
commit 192c99a4f6
13 changed files with 598 additions and 105 deletions
@@ -16,7 +16,7 @@ import android.graphics.Canvas;
* Instances of DrawCommand are created in background thread and passed to UI thread.
* Once a DrawCommand is shared with UI thread, it can no longer be mutated in background thread.
*/
public interface DrawCommand {
public abstract class DrawCommand {
// used by StateBuilder, FlatViewGroup and FlatShadowNode
/* package */ static final DrawCommand[] EMPTY_ARRAY = new DrawCommand[0];
@@ -26,7 +26,7 @@ public interface DrawCommand {
* @param parent The parent to get child information from, if needed
* @param canvas The canvas to draw into
*/
public void draw(FlatViewGroup parent, Canvas canvas);
abstract void draw(FlatViewGroup parent, Canvas canvas);
/**
* Performs debug bounds drawing into the given canvas.
@@ -34,5 +34,13 @@ public interface DrawCommand {
* @param parent The parent to get child information from, if needed
* @param canvas The canvas to draw into
*/
public void debugDraw(FlatViewGroup parent, Canvas canvas);
abstract void debugDraw(FlatViewGroup parent, Canvas canvas);
abstract float getLeft();
abstract float getTop();
abstract float getRight();
abstract float getBottom();
}