mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-05 09:29:07 +08:00
Do less work in Nodes when clipping isn't needed
Summary: By default, Nodes causes views to not be clipped, unless overflow is explicitly set to hidden. Consequently, Nodes sets all the clipping bounds to negative infinity, and does some extra work (saving the canvas layer, clipping, etc) before drawing. This optimization skips the extra work when it's not needed. Reviewed By: sriramramani Differential Revision: D3161268
This commit is contained in:
@@ -21,9 +21,13 @@ import android.graphics.Canvas;
|
||||
|
||||
@Override
|
||||
public void draw(FlatViewGroup parent, Canvas canvas) {
|
||||
canvas.save();
|
||||
applyClipping(canvas);
|
||||
parent.drawNextChild(canvas);
|
||||
canvas.restore();
|
||||
if (mNeedsClipping) {
|
||||
canvas.save();
|
||||
applyClipping(canvas);
|
||||
parent.drawNextChild(canvas);
|
||||
canvas.restore();
|
||||
} else {
|
||||
parent.drawNextChild(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user