From 5a743ad4c85067a22ee3d0f03878364ec6c61bdc Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 3 Dec 2022 10:20:10 -0500 Subject: [PATCH] Standardize Default member in PixelRect --- samples/ControlCatalog/Pages/ImagePage.xaml.cs | 2 +- src/Avalonia.Base/PixelRect.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/samples/ControlCatalog/Pages/ImagePage.xaml.cs b/samples/ControlCatalog/Pages/ImagePage.xaml.cs index 511b01c7ac..00878dc5a8 100644 --- a/samples/ControlCatalog/Pages/ImagePage.xaml.cs +++ b/samples/ControlCatalog/Pages/ImagePage.xaml.cs @@ -70,7 +70,7 @@ namespace ControlCatalog.Pages 3 => new PixelRect(new PixelPoint(bitmapWidth - cropSize.Width, 0), cropSize), 4 => new PixelRect(new PixelPoint(0, bitmapHeight - cropSize.Height), cropSize), 5 => new PixelRect(new PixelPoint(bitmapWidth - cropSize.Width, bitmapHeight - cropSize.Height), cropSize), - _ => PixelRect.Empty + _ => PixelRect.Default }; } diff --git a/src/Avalonia.Base/PixelRect.cs b/src/Avalonia.Base/PixelRect.cs index 409a259182..330edbd872 100644 --- a/src/Avalonia.Base/PixelRect.cs +++ b/src/Avalonia.Base/PixelRect.cs @@ -10,9 +10,13 @@ namespace Avalonia public readonly struct PixelRect : IEquatable { /// - /// An empty rectangle. + /// A shared default instance representing an empty rectangle. /// - public static readonly PixelRect Empty = default; + public static readonly PixelRect Default = default; + + /// + [Obsolete("Use Default instead.")] + public static readonly PixelRect Empty = Default; /// /// Initializes a new instance of the structure. @@ -261,7 +265,7 @@ namespace Avalonia } else { - return Empty; + return Default; } }