Clip masks and mattes to the canvas (#1246)

This fixes #1199 and improves performance by never saving a layer outside of the canvas. Thanks to @pmecho for the repro steps!
diff --git a/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java b/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java
index e828ff6..3386fa8 100644
--- a/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java
+++ b/lottie/src/main/java/com/airbnb/lottie/model/layer/BaseLayer.java
@@ -251,6 +251,10 @@
     matrix.preConcat(transform.getMatrix());
     intersectBoundsWithMask(rect, matrix);
 
+    if (!rect.intersect(0, 0, canvas.getWidth(), canvas.getHeight())) {
+      rect.set(0, 0, 0, 0);
+    }
+
     L.endSection("Layer#computeBounds");
 
     if (!rect.isEmpty()) {