Skip to content

Commit d1ded5e

Browse files
committed
(#359) WofBrushFactory: make everything private and readonly
1 parent 9853017 commit d1ded5e

7 files changed

Lines changed: 14 additions & 11 deletions

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1414
- .NET Framework 4.6.2 or later,
1515
- .NET 6.0 and later.
1616
- **(Breaking change.)** `WpfMath.Colors.IColorParser::Parse` now accepts `IReadOnlyList` instead of `IEnumerable`.
17-
- **(Minor breaking change.)** `XamlMath.Colors.StandardColorParsers::Dictionary` public field is now `readonly`.
17+
- **(Minor breaking change.)** `XamlMath.Colors.StandardColorParsers::Dictionary` static public field is now `readonly`.
18+
- **(Minor breaking change.)** `WpfMath.Rendering.WpfBrushFactory`'s constructor is now `private`.
19+
- **(Minor breaking change.)** `WpfMath.Rendering.WpfBrushFactory::Instance` static public field is now `readonly`.
1820

1921
### Removed
2022
- **(Breaking change.)** Delete the `TexRenderer` class. Use extension methods from `WpfMath.Rendering.WpfTeXFormulaExtensions` and `WpfMath.Rendering.TeXFormulaExtensions` to replace its functionality in your code.

api/WpfMath.net462.verified.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ public static partial class WpfBrushExtensions
122122
}
123123
public partial class WpfBrushFactory : XamlMath.Rendering.IBrushFactory
124124
{
125-
public static WpfMath.Rendering.WpfBrushFactory Instance;
126-
public WpfBrushFactory() { }
125+
internal WpfBrushFactory() { }
126+
public static readonly WpfMath.Rendering.WpfBrushFactory Instance;
127127
public XamlMath.Rendering.IBrush FromColor(XamlMath.Colors.RgbaColor color) { throw null; }
128128
}
129129
public static partial class WpfTeXEnvironment

api/WpfMath.net6.0.verified.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ public static partial class WpfBrushExtensions
124124
}
125125
public partial class WpfBrushFactory : XamlMath.Rendering.IBrushFactory
126126
{
127-
public static WpfMath.Rendering.WpfBrushFactory Instance;
128-
public WpfBrushFactory() { }
127+
internal WpfBrushFactory() { }
128+
public static readonly WpfMath.Rendering.WpfBrushFactory Instance;
129129
public XamlMath.Rendering.IBrush FromColor(XamlMath.Colors.RgbaColor color) { throw null; }
130130
}
131131
public static partial class WpfTeXEnvironment

api/XamlMath.Shared.net462.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public partial struct RgbaColor : System.IEquatable<XamlMath.Colors.RgbaColor>
246246
}
247247
public static partial class StandardColorParsers
248248
{
249-
public static System.Collections.Generic.IReadOnlyDictionary<string, XamlMath.Colors.IColorParser> Dictionary;
249+
public static readonly System.Collections.Generic.IReadOnlyDictionary<string, XamlMath.Colors.IColorParser> Dictionary;
250250
}
251251
}
252252
namespace XamlMath.Exceptions

api/XamlMath.Shared.net6.0.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public partial struct RgbaColor : System.IEquatable<XamlMath.Colors.RgbaColor>
246246
}
247247
public static partial class StandardColorParsers
248248
{
249-
public static System.Collections.Generic.IReadOnlyDictionary<string, XamlMath.Colors.IColorParser> Dictionary;
249+
public static readonly System.Collections.Generic.IReadOnlyDictionary<string, XamlMath.Colors.IColorParser> Dictionary;
250250
}
251251
}
252252
namespace XamlMath.Exceptions

api/XamlMath.Shared.netstandard2.0.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public partial struct RgbaColor : System.IEquatable<XamlMath.Colors.RgbaColor>
246246
}
247247
public static partial class StandardColorParsers
248248
{
249-
public static System.Collections.Generic.IReadOnlyDictionary<string, XamlMath.Colors.IColorParser> Dictionary;
249+
public static readonly System.Collections.Generic.IReadOnlyDictionary<string, XamlMath.Colors.IColorParser> Dictionary;
250250
}
251251
}
252252
namespace XamlMath.Exceptions

src/WpfMath/Rendering/WpfBrush.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ private WpfBrush(Brush brush) : base(brush)
1515

1616
public class WpfBrushFactory : IBrushFactory
1717
{
18-
// TODO[#359]: private constructor
19-
// TODO[#359]: readonly property instead of a writeable field
20-
public static WpfBrushFactory Instance = new();
18+
public static readonly WpfBrushFactory Instance = new();
19+
20+
private WpfBrushFactory() {}
21+
2122
public IBrush FromColor(RgbaColor color) =>
2223
new SolidColorBrush(
2324
Color.FromArgb(color.A, color.R, color.G, color.B)).ToPlatform();

0 commit comments

Comments
 (0)