Browse Source

Standardize IsDefault member in BoxShadow

pull/9590/head
robloo 4 years ago
parent
commit
9634a2cccf
  1. 11
      src/Avalonia.Base/Media/BoxShadow.cs
  2. 4
      src/Avalonia.Base/Media/BoxShadows.cs
  3. 4
      src/Skia/Avalonia.Skia/DrawingContextImpl.cs

11
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";
}

4
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;
}

4
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))
{

Loading…
Cancel
Save