Browse Source

Make _isOpen non-nullable since the only two values that were used were true and null.

pull/1685/head
Jeremy Koritzinsky 8 years ago
parent
commit
11d3e7f7e3
  1. 26
      src/Avalonia.Visuals/Media/PathMarkupParser.cs

26
src/Avalonia.Visuals/Media/PathMarkupParser.cs

@ -33,7 +33,7 @@ namespace Avalonia.Media
private IGeometryContext _geometryContext; private IGeometryContext _geometryContext;
private Point _currentPoint; private Point _currentPoint;
private Point? _previousControlPoint; private Point? _previousControlPoint;
private bool? _isOpen; private bool _isOpen;
private bool _isDisposed; private bool _isDisposed;
/// <summary> /// <summary>
@ -162,7 +162,7 @@ namespace Avalonia.Media
} }
} }
if (_isOpen != null) if (_isOpen)
{ {
_geometryContext.EndFigure(false); _geometryContext.EndFigure(false);
} }
@ -170,7 +170,7 @@ namespace Avalonia.Media
private void CreateFigure() private void CreateFigure()
{ {
if (_isOpen != null) if (_isOpen)
{ {
_geometryContext.EndFigure(false); _geometryContext.EndFigure(false);
} }
@ -189,14 +189,14 @@ namespace Avalonia.Media
private void CloseFigure() private void CloseFigure()
{ {
if (_isOpen == true) if (_isOpen)
{ {
_geometryContext.EndFigure(true); _geometryContext.EndFigure(true);
} }
_previousControlPoint = null; _previousControlPoint = null;
_isOpen = null; _isOpen = false;
} }
private void AddMove(CommandToken commandToken) private void AddMove(CommandToken commandToken)
@ -227,7 +227,7 @@ namespace Avalonia.Media
? commandToken.ReadRelativePoint(_currentPoint) ? commandToken.ReadRelativePoint(_currentPoint)
: commandToken.ReadPoint(); : commandToken.ReadPoint();
if (_isOpen == null) if (!_isOpen)
{ {
CreateFigure(); CreateFigure();
} }
@ -241,7 +241,7 @@ namespace Avalonia.Media
? new Point(_currentPoint.X + commandToken.ReadDouble(), _currentPoint.Y) ? new Point(_currentPoint.X + commandToken.ReadDouble(), _currentPoint.Y)
: _currentPoint.WithX(commandToken.ReadDouble()); : _currentPoint.WithX(commandToken.ReadDouble());
if (_isOpen == null) if (!_isOpen)
{ {
CreateFigure(); CreateFigure();
} }
@ -255,7 +255,7 @@ namespace Avalonia.Media
? new Point(_currentPoint.X, _currentPoint.Y + commandToken.ReadDouble()) ? new Point(_currentPoint.X, _currentPoint.Y + commandToken.ReadDouble())
: _currentPoint.WithY(commandToken.ReadDouble()); : _currentPoint.WithY(commandToken.ReadDouble());
if (_isOpen == null) if (!_isOpen)
{ {
CreateFigure(); CreateFigure();
} }
@ -279,7 +279,7 @@ namespace Avalonia.Media
? commandToken.ReadRelativePoint(_currentPoint) ? commandToken.ReadRelativePoint(_currentPoint)
: commandToken.ReadPoint(); : commandToken.ReadPoint();
if (_isOpen == null) if (!_isOpen)
{ {
CreateFigure(); CreateFigure();
} }
@ -301,7 +301,7 @@ namespace Avalonia.Media
? commandToken.ReadRelativePoint(_currentPoint) ? commandToken.ReadRelativePoint(_currentPoint)
: commandToken.ReadPoint(); : commandToken.ReadPoint();
if (_isOpen == null) if (!_isOpen)
{ {
CreateFigure(); CreateFigure();
} }
@ -326,7 +326,7 @@ namespace Avalonia.Media
_previousControlPoint = MirrorControlPoint((Point)_previousControlPoint, _currentPoint); _previousControlPoint = MirrorControlPoint((Point)_previousControlPoint, _currentPoint);
} }
if (_isOpen == null) if (!_isOpen)
{ {
CreateFigure(); CreateFigure();
} }
@ -349,7 +349,7 @@ namespace Avalonia.Media
_previousControlPoint = MirrorControlPoint((Point)_previousControlPoint, _currentPoint); _previousControlPoint = MirrorControlPoint((Point)_previousControlPoint, _currentPoint);
} }
if (_isOpen == null) if (!_isOpen)
{ {
CreateFigure(); CreateFigure();
} }
@ -373,7 +373,7 @@ namespace Avalonia.Media
? commandToken.ReadRelativePoint(_currentPoint) ? commandToken.ReadRelativePoint(_currentPoint)
: commandToken.ReadPoint(); : commandToken.ReadPoint();
if (_isOpen == null) if (!_isOpen)
{ {
CreateFigure(); CreateFigure();
} }

Loading…
Cancel
Save