From 015dc659cea9b3b5909382bb82746b202cc3db08 Mon Sep 17 00:00:00 2001 From: Maundytime Date: Thu, 6 Mar 2025 12:26:44 +0800 Subject: [PATCH 1/2] Fix the discontinuity when appending the path --- Source/Parser/SVG/SVGPathReader.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Parser/SVG/SVGPathReader.swift b/Source/Parser/SVG/SVGPathReader.swift index e3f00f45..8b7a8085 100644 --- a/Source/Parser/SVG/SVGPathReader.swift +++ b/Source/Parser/SVG/SVGPathReader.swift @@ -560,13 +560,13 @@ extension SVGPath { bezierPath.addArc(withCenter: CGPoint(x: cx, y: cy), radius: CGFloat(w / 2), startAngle: extent, endAngle: end, clockwise: arcAngle >= 0) } else { let maxSize = CGFloat(max(w, h)) - let path = MBezierPath(arcCenter: CGPoint.zero, radius: maxSize / 2, startAngle: extent, endAngle: end, clockwise: arcAngle >= 0) - var transform = CGAffineTransform(translationX: cx, y: cy) transform = transform.rotated(by: CGFloat(rotation)) - path.apply(transform.scaledBy(x: CGFloat(w) / maxSize, y: CGFloat(h) / maxSize)) - - bezierPath.append(path) + transform = transform.scaledBy(x: CGFloat(w) / maxSize, y: CGFloat(h) / maxSize) + let mutablePath = CGMutablePath() + mutablePath.addPath(bezierPath.cgPath) + mutablePath.addArc(center: .zero, radius: maxSize / 2, startAngle: extent, endAngle: end, clockwise: arcAngle < 0, transform: transform) + bezierPath.cgPath = mutablePath } } From 5e1385f462ffc98d73b406e04ed8f10e20810086 Mon Sep 17 00:00:00 2001 From: Maundytime Date: Sun, 27 Jul 2025 19:53:47 +0800 Subject: [PATCH 2/2] Remove unused CoreGraphics imports --- Source/Parser/SVG/Attributes/SVGFontSizeAttribute.swift | 2 +- Source/Parser/SVG/Attributes/SVGLengthAttribute.swift | 2 +- Source/Parser/SVG/Elements/SVGShapeParser.swift | 2 +- Source/Parser/SVG/Elements/SVGStructureParsers.swift | 1 - Source/Parser/SVG/Primitives/SVGLengthParser.swift | 1 - Source/Parser/SVG/SVGContext.swift | 2 +- Source/Parser/SVG/SVGParserExtensions.swift | 2 +- Source/Parser/SVG/Settings/SVGScreen.swift | 2 +- Source/Parser/SVG/Settings/SVGSettings.swift | 1 - Source/Serialization/Serializer.swift | 1 - 10 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/Parser/SVG/Attributes/SVGFontSizeAttribute.swift b/Source/Parser/SVG/Attributes/SVGFontSizeAttribute.swift index 6f92235d..d1399c4e 100644 --- a/Source/Parser/SVG/Attributes/SVGFontSizeAttribute.swift +++ b/Source/Parser/SVG/Attributes/SVGFontSizeAttribute.swift @@ -5,7 +5,7 @@ // Created by Yuri Strot on 29.05.2022. // -import CoreGraphics +import Foundation class SVGFontSizeAttribute: SVGDefaultAttribute { diff --git a/Source/Parser/SVG/Attributes/SVGLengthAttribute.swift b/Source/Parser/SVG/Attributes/SVGLengthAttribute.swift index 25205c62..a0e1f060 100644 --- a/Source/Parser/SVG/Attributes/SVGLengthAttribute.swift +++ b/Source/Parser/SVG/Attributes/SVGLengthAttribute.swift @@ -5,7 +5,7 @@ // Created by Yuri Strot on 29.05.2022. // -import CoreGraphics +import Foundation class SVGLengthAttribute: SVGDefaultAttribute { diff --git a/Source/Parser/SVG/Elements/SVGShapeParser.swift b/Source/Parser/SVG/Elements/SVGShapeParser.swift index 0e3aa4ef..e2c8f381 100644 --- a/Source/Parser/SVG/Elements/SVGShapeParser.swift +++ b/Source/Parser/SVG/Elements/SVGShapeParser.swift @@ -5,7 +5,7 @@ // Created by Yuri Strot on 29.05.2022. // -import CoreGraphics +import Foundation class SVGShapeParser: SVGBaseElementParser { diff --git a/Source/Parser/SVG/Elements/SVGStructureParsers.swift b/Source/Parser/SVG/Elements/SVGStructureParsers.swift index 17bd6afa..4a137452 100644 --- a/Source/Parser/SVG/Elements/SVGStructureParsers.swift +++ b/Source/Parser/SVG/Elements/SVGStructureParsers.swift @@ -6,7 +6,6 @@ // import Foundation -import CoreGraphics class SVGViewportParser: SVGGroupParser { diff --git a/Source/Parser/SVG/Primitives/SVGLengthParser.swift b/Source/Parser/SVG/Primitives/SVGLengthParser.swift index cc514bc1..0312d3d6 100644 --- a/Source/Parser/SVG/Primitives/SVGLengthParser.swift +++ b/Source/Parser/SVG/Primitives/SVGLengthParser.swift @@ -6,7 +6,6 @@ // import Foundation -import CoreGraphics enum SVGLengthAxis { diff --git a/Source/Parser/SVG/SVGContext.swift b/Source/Parser/SVG/SVGContext.swift index 5b81bc24..2bd58ea1 100644 --- a/Source/Parser/SVG/SVGContext.swift +++ b/Source/Parser/SVG/SVGContext.swift @@ -5,7 +5,7 @@ // Created by Yuri Strot on 26.05.2022. // -import CoreGraphics +import Foundation protocol SVGContext { diff --git a/Source/Parser/SVG/SVGParserExtensions.swift b/Source/Parser/SVG/SVGParserExtensions.swift index ecfb6ed3..5eea75b4 100644 --- a/Source/Parser/SVG/SVGParserExtensions.swift +++ b/Source/Parser/SVG/SVGParserExtensions.swift @@ -5,7 +5,7 @@ // Created by Yuri Strot on 25.05.2022. // -import CoreGraphics +import Foundation extension CGFloat { diff --git a/Source/Parser/SVG/Settings/SVGScreen.swift b/Source/Parser/SVG/Settings/SVGScreen.swift index fb4d85c9..5c19dd9e 100644 --- a/Source/Parser/SVG/Settings/SVGScreen.swift +++ b/Source/Parser/SVG/Settings/SVGScreen.swift @@ -5,7 +5,7 @@ // Created by Yuri Strot on 27.05.2022. // -import CoreGraphics +import Foundation struct SVGScreen { diff --git a/Source/Parser/SVG/Settings/SVGSettings.swift b/Source/Parser/SVG/Settings/SVGSettings.swift index e2800a62..f838526b 100644 --- a/Source/Parser/SVG/Settings/SVGSettings.swift +++ b/Source/Parser/SVG/Settings/SVGSettings.swift @@ -6,7 +6,6 @@ // import Foundation -import CoreGraphics public struct SVGSettings { diff --git a/Source/Serialization/Serializer.swift b/Source/Serialization/Serializer.swift index bc7fadbe..e9732c42 100644 --- a/Source/Serialization/Serializer.swift +++ b/Source/Serialization/Serializer.swift @@ -6,7 +6,6 @@ // import Foundation -import CoreGraphics class Serializer {