From 7db444c9ae62cde6b6f1de29b928b70fe2d60b5b Mon Sep 17 00:00:00 2001 From: Denis Koroskin Date: Sun, 13 Dec 2015 09:54:25 -0800 Subject: [PATCH] Pass FlatViewGroup to DrawCommand.draw() Summary: @public To render `View`s inside `FlatViewGroup`, we need to pass the parent to `DrawCommand.draw()` method. Used in a followup diff. Reviewed By: sriramramani Differential Revision: D2564478 --- .../main/java/com/facebook/react/flat/DrawBackgroundColor.java | 2 +- .../src/main/java/com/facebook/react/flat/DrawBorder.java | 2 +- .../src/main/java/com/facebook/react/flat/DrawCommand.java | 2 +- .../java/com/facebook/react/flat/DrawImageWithPipeline.java | 2 +- .../src/main/java/com/facebook/react/flat/DrawTextLayout.java | 2 +- .../src/main/java/com/facebook/react/flat/FlatViewGroup.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawBackgroundColor.java b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawBackgroundColor.java index f04da77bc..c2d4215d5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawBackgroundColor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawBackgroundColor.java @@ -26,7 +26,7 @@ import android.graphics.Paint; } @Override - public void draw(Canvas canvas) { + public void draw(FlatViewGroup parent, Canvas canvas) { PAINT.setColor(mBackgroundColor); canvas.drawRect(getLeft(), getTop(), getRight(), getBottom(), PAINT); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawBorder.java b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawBorder.java index 3685e0840..66d68b5ed 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawBorder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawBorder.java @@ -169,7 +169,7 @@ import com.facebook.csslayout.Spacing; } @Override - public void draw(Canvas canvas) { + public void draw(FlatViewGroup parent, Canvas canvas) { if (getBorderRadius() >= 0.5f) { drawRoundedBorders(canvas); } else { diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawCommand.java b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawCommand.java index 7caceabca..9f3aec6c6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawCommand.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawCommand.java @@ -25,5 +25,5 @@ public interface DrawCommand { * * @param canvas The canvas to draw into */ - public void draw(Canvas canvas); + public void draw(FlatViewGroup parent, Canvas canvas); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawImageWithPipeline.java b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawImageWithPipeline.java index 0b60c8d7b..6cf23b8bb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawImageWithPipeline.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawImageWithPipeline.java @@ -80,7 +80,7 @@ import com.facebook.react.views.image.ImageResizeMode; } @Override - public void draw(Canvas canvas) { + public void draw(FlatViewGroup parent, Canvas canvas) { Bitmap bitmap = Assertions.assumeNotNull(mBitmapRequestHelper).getBitmap(); if (bitmap == null) { return; diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawTextLayout.java b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawTextLayout.java index abccbbe56..63d7037c8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/DrawTextLayout.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/DrawTextLayout.java @@ -31,7 +31,7 @@ import android.text.Layout; } @Override - public void draw(Canvas canvas) { + public void draw(FlatViewGroup parent, Canvas canvas) { float left = getLeft(); float top = getTop(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatViewGroup.java b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatViewGroup.java index 325850588..87462df87 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/flat/FlatViewGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/flat/FlatViewGroup.java @@ -56,7 +56,7 @@ import android.view.ViewGroup; super.dispatchDraw(canvas); for (DrawCommand drawCommand : mDrawCommands) { - drawCommand.draw(canvas); + drawCommand.draw(this, canvas); } }