Merge pull request #220 from maartenba/mb-perf-3

Re-use static variable instead of method call in TextStyle
This commit is contained in:
Marcin Ziąbek
2022-07-30 18:19:47 +02:00
committed by GitHub
+8 -2
View File
@@ -22,7 +22,10 @@ namespace QuestPDF.Infrastructure
internal object PaintKey { get; private set; }
internal object FontMetricsKey { get; private set; }
internal static TextStyle LibraryDefault => new TextStyle
// REVIEW: Should this be a method call that news up a TextStyle,
// or can it be a static variable?
// (style mutations seem to create a clone anyway)
internal static readonly TextStyle LibraryDefault = new TextStyle
{
Color = Colors.Black,
BackgroundColor = Colors.Transparent,
@@ -37,7 +40,10 @@ namespace QuestPDF.Infrastructure
WrapAnywhere = false
};
public static TextStyle Default => new TextStyle();
// REVIEW: Should this be a method call that news up a TextStyle,
// or can it be a static variable?
// (style mutations seem to create a clone anyway)
public static readonly TextStyle Default = new TextStyle();
internal void ApplyGlobalStyle(TextStyle globalStyle)
{