File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -197,11 +197,19 @@ extension LayerTree {
197197 case . gradient( let fillGradient) :
198198 commands. append ( . pushState)
199199 commands. append ( . setClip( path: path) )
200-
201- let pathBounds = provider. getBounds ( from: path)
202- let pathStart = pathBounds. getPoint ( offset: fillGradient. start)
203- let pathEnd = pathBounds. getPoint ( offset: fillGradient. end)
204-
200+
201+ let pathStart : LayerTree . Point
202+ let pathEnd : LayerTree . Point
203+ switch fillGradient. units {
204+ case . objectBoundingBox:
205+ let pathBounds = provider. getBounds ( from: path)
206+ pathStart = pathBounds. getPoint ( offset: fillGradient. start)
207+ pathEnd = pathBounds. getPoint ( offset: fillGradient. end)
208+ case . userSpaceOnUse:
209+ pathStart = fillGradient. start
210+ pathEnd = fillGradient. end
211+ }
212+
205213 let converted = apply ( colorConverter: colorConverter, to: fillGradient)
206214 let gradient = provider. createGradient ( from: converted)
207215 let start = provider. createPoint ( from: pathStart)
You can’t perform that action at this time.
0 commit comments