public static Rect FindCullAndClipWorldRect(List <RectMask2D> rectMaskParents, out bool validRect) { Rect result; if (rectMaskParents.Count == 0) { validRect = false; result = default(Rect); } else { Rect a = rectMaskParents[0].canvasRect; for (int i = 0; i < rectMaskParents.Count; i++) { a = Clipping.RectIntersect(a, rectMaskParents[i].canvasRect); } bool flag = a.width <= 0f || a.height <= 0f; if (flag) { validRect = false; result = default(Rect); } else { Vector3 vector = new Vector3(a.x, a.y, 0f); Vector3 vector2 = new Vector3(a.x + a.width, a.y + a.height, 0f); validRect = true; result = new Rect(vector.x, vector.y, vector2.x - vector.x, vector2.y - vector.y); } } return(result); }
public static Rect FindCullAndClipWorldRect(List <RectMask2D> rectMaskParents, out bool validRect) { if (rectMaskParents.Count == 0) { validRect = false; return(new Rect()); } Rect a = rectMaskParents[0].canvasRect; for (int index = 0; index < rectMaskParents.Count; ++index) { a = Clipping.RectIntersect(a, rectMaskParents[index].canvasRect); } if ((double)a.width <= 0.0 || (double)a.height <= 0.0) { validRect = false; return(new Rect()); } Vector3 vector3_1 = new Vector3(a.x, a.y, 0.0f); Vector3 vector3_2 = new Vector3(a.x + a.width, a.y + a.height, 0.0f); validRect = true; return(new Rect(vector3_1.x, vector3_1.y, vector3_2.x - vector3_1.x, vector3_2.y - vector3_1.y)); }