Created attachment 463245 [details] test case bug#244824 added transformedBoundingBox to calculate the bounding box of a layer transformed by 4x4 matrix. However, it isn't precise. For example, in the test case, the right side of the blue element is at infinity. transformedBoundingBox is assuming the positions of the right side are (inf, inf) and (-inf, -inf). We can calculate more precise bounding box by intersecting element edges with the viewport.
<rdar://problem/101835693>