using System.Drawing; using System.Runtime.CompilerServices; namespace ComputeSharp.D2D1; /// /// Helper methods for . /// public static class RectangleExtensions { /// /// Modifies a target instance to be a D2D1 infinite rectangle. /// /// The target instance to modify. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ToD2D1Infinite(this ref Rectangle rectangle) { rectangle = new Rectangle( int.MinValue / 2, int.MinValue / 2, int.MaxValue, int.MaxValue); } /// /// Checks whether a given instance represents a D2D1 infinite rectangle. /// /// The input instance to check. /// Whether or not represents a D2D1 infinite rectangle. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsD2D1Infinite(this in Rectangle rectangle) { return rectangle == new Rectangle( int.MinValue / 2, int.MinValue / 2, int.MaxValue, int.MaxValue); } }