Browse Source

Improved SkParagraphBuilderPoolManager cache

Marcin Ziąbek 1 year ago
parent
commit
f8e48e82dd

+ 1 - 1
Source/QuestPDF/Elements/Text/SkParagraphBuilderPoolManager.cs

@@ -31,7 +31,7 @@ internal static class SkParagraphBuilderPoolManager
         specificPool.Add(builder);
         specificPool.Add(builder);
     }
     }
 
 
-    static ConcurrentBag<SkParagraphBuilder> GetPool(ParagraphStyleConfiguration configuration)
+    private static ConcurrentBag<SkParagraphBuilder> GetPool(ParagraphStyleConfiguration configuration)
     {
     {
         var key = (configuration, Settings.UseEnvironmentFonts);
         var key = (configuration, Settings.UseEnvironmentFonts);
         return ObjectPool.GetOrAdd(key, _ => new ConcurrentBag<SkParagraphBuilder>());
         return ObjectPool.GetOrAdd(key, _ => new ConcurrentBag<SkParagraphBuilder>());

+ 1 - 1
Source/QuestPDF/Skia/Text/SkParagraphBuilder.cs

@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
 namespace QuestPDF.Skia.Text;
 namespace QuestPDF.Skia.Text;
 
 
 [StructLayout(LayoutKind.Sequential)]
 [StructLayout(LayoutKind.Sequential)]
-internal struct ParagraphStyleConfiguration
+internal record struct ParagraphStyleConfiguration
 {
 {
     public TextAlign Alignment;
     public TextAlign Alignment;
     public TextDirection Direction;
     public TextDirection Direction;