Build layer damage bounds for shadows

bug:15538815

Change-Id: I703afeb7e31c28002bd1aff9ce448ec8cdc4e70d
diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp
index 310b107..804ec41 100644
--- a/libs/hwui/PathTessellator.cpp
+++ b/libs/hwui/PathTessellator.cpp
@@ -794,16 +794,6 @@
     vertexBuffer.setBounds(bounds);
 }
 
-static void expandRectToCoverVertex(Rect& rect, float x, float y) {
-    rect.left = fminf(rect.left, x);
-    rect.top = fminf(rect.top, y);
-    rect.right = fmaxf(rect.right, x);
-    rect.bottom = fmaxf(rect.bottom, y);
-}
-static void expandRectToCoverVertex(Rect& rect, const Vertex& vertex) {
-    expandRectToCoverVertex(rect, vertex.x, vertex.y);
-}
-
 template <class TYPE>
 static void instanceVertices(VertexBuffer& srcBuffer, VertexBuffer& dstBuffer,
         const float* points, int count, Rect& bounds) {
@@ -814,7 +804,7 @@
     dstBuffer.alloc<TYPE>(numPoints * verticesPerPoint + (numPoints - 1) * 2);
 
     for (int i = 0; i < count; i += 2) {
-        expandRectToCoverVertex(bounds, points[i + 0], points[i + 1]);
+        bounds.expandToCoverVertex(points[i + 0], points[i + 1]);
         dstBuffer.copyInto<TYPE>(srcBuffer, points[i + 0], points[i + 1]);
     }
     dstBuffer.createDegenerateSeparators<TYPE>(verticesPerPoint);
@@ -896,8 +886,8 @@
         }
 
         // calculate bounds
-        expandRectToCoverVertex(bounds, tempVerticesData[0]);
-        expandRectToCoverVertex(bounds, tempVerticesData[1]);
+        bounds.expandToCoverVertex(tempVerticesData[0].x, tempVerticesData[0].y);
+        bounds.expandToCoverVertex(tempVerticesData[1].x, tempVerticesData[1].y);
     }
 
     // since multiple objects tessellated into buffer, separate them with degen tris