[android] Cache group paths.

This commit is contained in:
Mikael Sand
2019-01-06 21:10:45 +02:00
parent b559e73dbc
commit eb4e314681
@@ -126,18 +126,21 @@ class GroupView extends RenderableView {
@Override @Override
Path getPath(final Canvas canvas, final Paint paint) { Path getPath(final Canvas canvas, final Paint paint) {
final Path path = new Path(); if (mPath != null) {
return mPath;
}
mPath = new Path();
for (int i = 0; i < getChildCount(); i++) { for (int i = 0; i < getChildCount(); i++) {
View node = getChildAt(i); View node = getChildAt(i);
if (node instanceof VirtualView) { if (node instanceof VirtualView) {
VirtualView n = (VirtualView)node; VirtualView n = (VirtualView)node;
Matrix transform = n.mMatrix; Matrix transform = n.mMatrix;
path.addPath(n.getPath(canvas, paint), transform); mPath.addPath(n.getPath(canvas, paint), transform);
} }
} }
return path; return mPath;
} }
Path getPath(final Canvas canvas, final Paint paint, final Region.Op op) { Path getPath(final Canvas canvas, final Paint paint, final Region.Op op) {