diff --git a/src/Avalonia.Base/Media/FormattedText.cs b/src/Avalonia.Base/Media/FormattedText.cs
index 90b9755493..87dca16205 100644
--- a/src/Avalonia.Base/Media/FormattedText.cs
+++ b/src/Avalonia.Base/Media/FormattedText.cs
@@ -1383,7 +1383,7 @@ namespace Avalonia.Media
}
}
- if (accumulatedBounds?.PlatformImpl == null || accumulatedBounds.PlatformImpl.Bounds.IsEmpty)
+ if (accumulatedBounds?.PlatformImpl == null || accumulatedBounds.PlatformImpl.Bounds.IsDefault)
{
return null;
}
diff --git a/src/Avalonia.Base/Media/ImageDrawing.cs b/src/Avalonia.Base/Media/ImageDrawing.cs
index 82f97b52b4..d3e5c4841b 100644
--- a/src/Avalonia.Base/Media/ImageDrawing.cs
+++ b/src/Avalonia.Base/Media/ImageDrawing.cs
@@ -42,7 +42,7 @@ namespace Avalonia.Media
var imageSource = ImageSource;
var rect = Rect;
- if (imageSource is object && !rect.IsEmpty)
+ if (imageSource is object && !rect.IsDefault)
{
context.DrawImage(imageSource, rect);
}
diff --git a/src/Avalonia.Base/PixelRect.cs b/src/Avalonia.Base/PixelRect.cs
index 343bbccc9a..409a259182 100644
--- a/src/Avalonia.Base/PixelRect.cs
+++ b/src/Avalonia.Base/PixelRect.cs
@@ -133,7 +133,7 @@ namespace Avalonia
public PixelPoint Center => new PixelPoint(X + (Width / 2), Y + (Height / 2));
///
- /// Gets a value indicating whether the instance has default values.
+ /// Gets a value indicating whether the instance has default values (the rectangle is empty).
///
public bool IsDefault => Width == 0 && Height == 0;
diff --git a/src/Avalonia.Base/Rect.cs b/src/Avalonia.Base/Rect.cs
index a91b089a33..862e4caec1 100644
--- a/src/Avalonia.Base/Rect.cs
+++ b/src/Avalonia.Base/Rect.cs
@@ -169,12 +169,16 @@ namespace Avalonia
public Point Center => new Point(_x + (_width / 2), _y + (_height / 2));
///
- /// Gets a value that indicates whether the rectangle is empty.
+ /// Gets a value indicating whether the instance has default values (the rectangle is empty).
///
// ReSharper disable CompareOfFloatsByEqualityOperator
- public bool IsEmpty => _width == 0 && _height == 0;
+ public bool IsDefault => _width == 0 && _height == 0;
// ReSharper restore CompareOfFloatsByEqualityOperator
+ ///
+ [Obsolete("Use IsDefault instead.")]
+ public bool IsEmpty => IsDefault;
+
///
/// Checks for equality between two s.
///
@@ -457,7 +461,7 @@ namespace Avalonia
///
public Rect Normalize()
{
- Rect rect = this;
+ Rect rect = this;
if(double.IsNaN(rect.Right) || double.IsNaN(rect.Bottom) ||
double.IsNaN(rect.X) || double.IsNaN(rect.Y) ||
@@ -493,11 +497,11 @@ namespace Avalonia
/// The union.
public Rect Union(Rect rect)
{
- if (IsEmpty)
+ if (IsDefault)
{
return rect;
}
- else if (rect.IsEmpty)
+ else if (rect.IsDefault)
{
return this;
}
diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
index 5c1ac0312c..a8fcdc41cd 100644
--- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
@@ -89,7 +89,7 @@ namespace Avalonia.Rendering.Composition.Server
Compositor.UpdateServerTime();
- if(_dirtyRect.IsEmpty && !_redrawRequested)
+ if(_dirtyRect.IsDefault && !_redrawRequested)
return;
Revision++;
@@ -117,7 +117,7 @@ namespace Avalonia.Rendering.Composition.Server
_layerSize = layerSize;
}
- if (!_dirtyRect.IsEmpty)
+ if (!_dirtyRect.IsDefault)
{
var visualBrushHelper = new CompositorDrawingContextProxy.VisualBrushRenderer();
using (var context = _layer.CreateDrawingContext(visualBrushHelper))
@@ -179,7 +179,7 @@ namespace Avalonia.Rendering.Composition.Server
public void AddDirtyRect(Rect rect)
{
- if(rect.IsEmpty)
+ if(rect.IsDefault)
return;
var snapped = SnapToDevicePixels(rect, Scaling);
DebugEvents?.RectInvalidated(rect);
diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs
index d724e14298..5e6dcab209 100644
--- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs
@@ -37,7 +37,7 @@ namespace Avalonia.Rendering.Composition.Server
return;
currentTransformedClip = currentTransformedClip.Intersect(_combinedTransformedClipBounds);
- if(currentTransformedClip.IsEmpty)
+ if(currentTransformedClip.IsDefault)
return;
Root!.RenderedVisuals++;
@@ -139,7 +139,7 @@ namespace Avalonia.Rendering.Composition.Server
if (ownBounds != _oldOwnContentBounds || positionChanged)
{
_oldOwnContentBounds = ownBounds;
- if (ownBounds.IsEmpty)
+ if (ownBounds.IsDefault)
TransformedOwnContentBounds = default;
else
TransformedOwnContentBounds =
@@ -163,7 +163,7 @@ namespace Avalonia.Rendering.Composition.Server
EffectiveOpacity = Opacity * (Parent?.EffectiveOpacity ?? 1);
IsVisibleInFrame = _parent?.IsVisibleInFrame != false && Visible && EffectiveOpacity > 0.04 && !_isBackface &&
- !_combinedTransformedClipBounds.IsEmpty;
+ !_combinedTransformedClipBounds.IsDefault;
if (wasVisible != IsVisibleInFrame || positionChanged)
{
diff --git a/src/Avalonia.Base/Rendering/DeferredRenderer.cs b/src/Avalonia.Base/Rendering/DeferredRenderer.cs
index 971702269c..33820a0eac 100644
--- a/src/Avalonia.Base/Rendering/DeferredRenderer.cs
+++ b/src/Avalonia.Base/Rendering/DeferredRenderer.cs
@@ -420,7 +420,7 @@ namespace Avalonia.Rendering
{
clipBounds = node.ClipBounds.Intersect(clipBounds);
- if (!clipBounds.IsEmpty && node.Opacity > 0)
+ if (!clipBounds.IsDefault && node.Opacity > 0)
{
var isLayerRoot = node.Visual == layer;
diff --git a/src/Avalonia.Base/Rendering/DirtyRects.cs b/src/Avalonia.Base/Rendering/DirtyRects.cs
index f4b6a6b6ce..e4238f8308 100644
--- a/src/Avalonia.Base/Rendering/DirtyRects.cs
+++ b/src/Avalonia.Base/Rendering/DirtyRects.cs
@@ -27,7 +27,7 @@ namespace Avalonia.Rendering
///
public void Add(Rect rect)
{
- if (!rect.IsEmpty)
+ if (!rect.IsDefault)
{
for (var i = 0; i < _rects.Count; ++i)
{
diff --git a/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs b/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
index 6b1796e50b..c308312398 100644
--- a/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
+++ b/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
@@ -192,14 +192,14 @@ namespace Avalonia.Controls
void OnLayoutUpdated(object sender, EventArgs e)
{
- if(!editingCheckBox.Bounds.IsEmpty)
+ if(!editingCheckBox.Bounds.IsDefault)
{
editingCheckBox.LayoutUpdated -= OnLayoutUpdated;
ProcessPointerArgs();
}
}
- if(editingCheckBox.Bounds.IsEmpty)
+ if(editingCheckBox.Bounds.IsDefault)
{
editingCheckBox.LayoutUpdated += OnLayoutUpdated;
}
diff --git a/src/Avalonia.Controls/NativeControlHost.cs b/src/Avalonia.Controls/NativeControlHost.cs
index bcf0866129..18dc1b1264 100644
--- a/src/Avalonia.Controls/NativeControlHost.cs
+++ b/src/Avalonia.Controls/NativeControlHost.cs
@@ -145,7 +145,7 @@ namespace Avalonia.Controls
if (IsEffectivelyVisible && bounds.HasValue)
{
- if (bounds.Value.IsEmpty)
+ if (bounds.Value.IsDefault)
return false;
_attachment?.ShowInBounds(bounds.Value);
}
diff --git a/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs b/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs
index a80a60350e..62e5f37273 100644
--- a/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs
+++ b/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs
@@ -112,7 +112,7 @@ namespace Avalonia.Controls.Primitives.PopupPositioning
?? screens.FirstOrDefault(s => s.Bounds.Intersects(parentGeometry))
?? screens.FirstOrDefault();
- if (targetScreen != null && targetScreen.WorkingArea.IsEmpty)
+ if (targetScreen != null && targetScreen.WorkingArea.IsDefault)
{
return targetScreen.Bounds;
}
diff --git a/src/Avalonia.Controls/Repeater/ViewportManager.cs b/src/Avalonia.Controls/Repeater/ViewportManager.cs
index e24ed37f1e..10e3dd57a0 100644
--- a/src/Avalonia.Controls/Repeater/ViewportManager.cs
+++ b/src/Avalonia.Controls/Repeater/ViewportManager.cs
@@ -465,7 +465,7 @@ namespace Avalonia.Controls
_pendingViewportShift = default;
_unshiftableShift = default;
- if (_visibleWindow.IsEmpty)
+ if (_visibleWindow.IsDefault)
{
// We got cleared.
_layoutExtent = default;
@@ -551,7 +551,7 @@ namespace Avalonia.Controls
private void TryInvalidateMeasure()
{
// Don't invalidate measure if we have an invalid window.
- if (!_visibleWindow.IsEmpty)
+ if (!_visibleWindow.IsDefault)
{
// We invalidate measure instead of just invalidating arrange because
// we don't invalidate measure in UpdateViewport if the view is changing to