Skip to content

Commit a93b7ea

Browse files
committed
Start improving dash patters
1 parent d071ca4 commit a93b7ea

File tree

8 files changed

+5
-5
lines changed

8 files changed

+5
-5
lines changed
66 Bytes
Loading
515 KB
Loading
86 Bytes
Loading
197 KB
Loading
-844 Bytes
Loading
-451 Bytes
Loading

UglyToad.PdfPig.Rendering.Skia.Tests/TestRendering.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public void TestAtScale(string expectedImage, string pdfFile, int pageNumber, in
401401
public void PdfPigSkiaTest(string expectedImage, string pdfFile, int pageNumber, int scale)
402402
{
403403
#if DEBUG
404-
throw new System.ArgumentException("PdfPigSkiaTest needs to run in Release mode.");
404+
//throw new System.ArgumentException("PdfPigSkiaTest needs to run in Release mode.");
405405
#endif
406406

407407
expectedImage = Path.Combine("pdfpig_skia", expectedImage);

UglyToad.PdfPig.Rendering.Skia/Helpers/SkiaExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public static SKPathEffect ToSKPathEffect(this LineDashPattern lineDashPattern,
114114
return null;
115115
}
116116

117-
float scale = lineWidth * oneOver72 / 2; // TODO - Scale is still not correct
117+
float scale = 1f / lineWidth; //oneOver72 / 2; // TODO - Scale is still not correct
118118

119119
float phase = lineDashPattern.Phase * scale;
120120

@@ -130,14 +130,14 @@ public static SKPathEffect ToSKPathEffect(this LineDashPattern lineDashPattern,
130130
float[] pattern = new float[lineDashPattern.Array.Count];
131131
for (int i = 0; i < lineDashPattern.Array.Count; i++)
132132
{
133-
var v = (float)lineDashPattern.Array[i] * scale;
133+
var v = (float)lineDashPattern.Array[i];
134134
if (v == 0)
135135
{
136-
pattern[i] = oneOver72;
136+
pattern[i] = scale; // TODO - Need to add tests
137137
}
138138
else
139139
{
140-
pattern[i] = v;
140+
pattern[i] = v * scale;
141141
}
142142
}
143143

0 commit comments

Comments
 (0)