Browse Source

Standardize IsDefault member in BoxShadow

robloo 2 years ago
parent
commit
9634a2cccf

+ 9 - 2
src/Avalonia.Base/Media/BoxShadow.cs

@@ -45,7 +45,14 @@ namespace Avalonia.Media
             }
         }
 
-        public bool IsEmpty => OffsetX == 0 && OffsetY == 0 && Blur == 0 && Spread == 0;
+        /// <summary>
+        /// Gets a value indicating whether the instance has default values.
+        /// </summary>
+        public bool IsDefault => OffsetX == 0 && OffsetY == 0 && Blur == 0 && Spread == 0;
+
+        /// <inheritdoc cref="IsDefault"/>
+        [Obsolete("Use IsDefault instead.")]
+        public bool IsEmpty => IsDefault;
 
         private readonly static char[] s_Separator = new char[] { ' ', '\t' };
 
@@ -82,7 +89,7 @@ namespace Avalonia.Media
         {
             var sb = StringBuilderCache.Acquire();
 
-            if (IsEmpty)
+            if (IsDefault)
             {
                 return "none";
             }

+ 2 - 2
src/Avalonia.Base/Media/BoxShadows.cs

@@ -21,7 +21,7 @@ namespace Avalonia.Media
         {
             _first = shadow;
             _list = null;
-            Count = _first.IsEmpty ? 0 : 1;
+            Count = _first.IsDefault ? 0 : 1;
         }
 
         public BoxShadows(BoxShadow first, BoxShadow[] rest)
@@ -118,7 +118,7 @@ namespace Avalonia.Media
             get
             {
                 foreach(var boxShadow in this)
-                    if (!boxShadow.IsEmpty && boxShadow.IsInset)
+                    if (!boxShadow.IsDefault && boxShadow.IsInset)
                         return true;
                 return false;
             }

+ 2 - 2
src/Skia/Avalonia.Skia/DrawingContextImpl.cs

@@ -362,7 +362,7 @@ namespace Avalonia.Skia
 
             foreach (var boxShadow in boxShadows)
             {
-                if (!boxShadow.IsEmpty && !boxShadow.IsInset)
+                if (!boxShadow.IsDefault && !boxShadow.IsInset)
                 {
                     using (var shadow = BoxShadowFilter.Create(_boxShadowPaint, boxShadow, _currentOpacity))
                     {
@@ -418,7 +418,7 @@ namespace Avalonia.Skia
 
             foreach (var boxShadow in boxShadows)
             {
-                if (!boxShadow.IsEmpty && boxShadow.IsInset)
+                if (!boxShadow.IsDefault && boxShadow.IsInset)
                 {
                     using (var shadow = BoxShadowFilter.Create(_boxShadowPaint, boxShadow, _currentOpacity))
                     {