mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor DrawView to avoid extra allocates.
Summary: Previously, the first time we collected a draw view, we would make a clone, even though the draw view had never been mutated. This refactors draw view to avoid this extra allocate. Reviewed By: ahmedre Differential Revision: D3719056
This commit is contained in:
committed by
Ahmed El-Helw
parent
cc216b5ec3
commit
b2f41e2921
@@ -42,7 +42,7 @@ import android.graphics.Color;
|
||||
&& mClipRight == clipRight && mClipBottom == clipBottom;
|
||||
}
|
||||
|
||||
public final void setClipBounds(
|
||||
protected final void setClipBounds(
|
||||
float clipLeft,
|
||||
float clipTop,
|
||||
float clipRight,
|
||||
@@ -185,6 +185,13 @@ import android.graphics.Color;
|
||||
return mFrozen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark this object as frozen, indicating that it should not be mutated.
|
||||
*/
|
||||
public final void freeze() {
|
||||
mFrozen = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Left position of this DrawCommand relative to the hosting View.
|
||||
*/
|
||||
@@ -226,7 +233,7 @@ import android.graphics.Color;
|
||||
/**
|
||||
* Updates boundaries of this DrawCommand.
|
||||
*/
|
||||
private void setBounds(float left, float top, float right, float bottom) {
|
||||
protected final void setBounds(float left, float top, float right, float bottom) {
|
||||
mLeft = left;
|
||||
mTop = top;
|
||||
mRight = right;
|
||||
@@ -238,7 +245,7 @@ import android.graphics.Color;
|
||||
/**
|
||||
* Returns true if boundaries match and don't need to be updated. False otherwise.
|
||||
*/
|
||||
private boolean boundsMatch(float left, float top, float right, float bottom) {
|
||||
protected final boolean boundsMatch(float left, float top, float right, float bottom) {
|
||||
return mLeft == left && mTop == top && mRight == right && mBottom == bottom;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user