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
This commit is contained in:
Denis Koroskin 2015-12-13 09:54:25 -08:00 committed by Ahmed El-Helw
parent f19acaed4b
commit 7db444c9ae
6 changed files with 6 additions and 6 deletions

View File

@ -26,7 +26,7 @@ import android.graphics.Paint;
} }
@Override @Override
public void draw(Canvas canvas) { public void draw(FlatViewGroup parent, Canvas canvas) {
PAINT.setColor(mBackgroundColor); PAINT.setColor(mBackgroundColor);
canvas.drawRect(getLeft(), getTop(), getRight(), getBottom(), PAINT); canvas.drawRect(getLeft(), getTop(), getRight(), getBottom(), PAINT);
} }

View File

@ -169,7 +169,7 @@ import com.facebook.csslayout.Spacing;
} }
@Override @Override
public void draw(Canvas canvas) { public void draw(FlatViewGroup parent, Canvas canvas) {
if (getBorderRadius() >= 0.5f) { if (getBorderRadius() >= 0.5f) {
drawRoundedBorders(canvas); drawRoundedBorders(canvas);
} else { } else {

View File

@ -25,5 +25,5 @@ public interface DrawCommand {
* *
* @param canvas The canvas to draw into * @param canvas The canvas to draw into
*/ */
public void draw(Canvas canvas); public void draw(FlatViewGroup parent, Canvas canvas);
} }

View File

@ -80,7 +80,7 @@ import com.facebook.react.views.image.ImageResizeMode;
} }
@Override @Override
public void draw(Canvas canvas) { public void draw(FlatViewGroup parent, Canvas canvas) {
Bitmap bitmap = Assertions.assumeNotNull(mBitmapRequestHelper).getBitmap(); Bitmap bitmap = Assertions.assumeNotNull(mBitmapRequestHelper).getBitmap();
if (bitmap == null) { if (bitmap == null) {
return; return;

View File

@ -31,7 +31,7 @@ import android.text.Layout;
} }
@Override @Override
public void draw(Canvas canvas) { public void draw(FlatViewGroup parent, Canvas canvas) {
float left = getLeft(); float left = getLeft();
float top = getTop(); float top = getTop();

View File

@ -56,7 +56,7 @@ import android.view.ViewGroup;
super.dispatchDraw(canvas); super.dispatchDraw(canvas);
for (DrawCommand drawCommand : mDrawCommands) { for (DrawCommand drawCommand : mDrawCommands) {
drawCommand.draw(canvas); drawCommand.draw(this, canvas);
} }
} }