mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 18:36:11 +02:00
💄 Change naming and args order of write-gradient-fill!
This commit is contained in:
parent
4bf9e24d43
commit
1da623e63f
2 changed files with 6 additions and 5 deletions
|
@ -227,7 +227,7 @@
|
|||
(let [size (sr-fills/gradient-byte-size gradient)
|
||||
offset (mem/alloc-bytes size)
|
||||
heap (mem/get-heap-u32)]
|
||||
(sr-fills/serialize-gradient-fill gradient opacity heap offset)
|
||||
(sr-fills/write-gradient-fill! offset heap gradient opacity)
|
||||
(case (:type gradient)
|
||||
:linear
|
||||
(h/call wasm/internal-module "_add_shape_linear_fill")
|
||||
|
@ -273,7 +273,7 @@
|
|||
(let [size (sr-fills/gradient-byte-size gradient)
|
||||
offset (mem/alloc-bytes size)
|
||||
heap (mem/get-heap-u32)]
|
||||
(sr-fills/serialize-gradient-fill gradient opacity heap offset)
|
||||
(sr-fills/write-gradient-fill! offset heap gradient opacity)
|
||||
(case (:type gradient)
|
||||
:linear
|
||||
(h/call wasm/internal-module "_add_shape_stroke_linear_fill")
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
(let [stops (:stops gradient)]
|
||||
(+ GRADIENT-BASE-SIZE (* (count stops) GRADIENT-STOP-SIZE))))
|
||||
|
||||
(defn serialize-gradient-fill
|
||||
[gradient opacity heap offset]
|
||||
(defn write-gradient-fill!
|
||||
[offset heap gradient opacity]
|
||||
(let [dview (js/DataView. (.-buffer heap))
|
||||
start-x (:start-x gradient)
|
||||
start-y (:start-y gradient)
|
||||
|
@ -26,7 +26,8 @@
|
|||
(.setFloat32 dview (+ offset 16) opacity true)
|
||||
(.setFloat32 dview (+ offset 20) width true)
|
||||
(loop [stops (seq stops) offset (+ offset GRADIENT-BASE-SIZE)]
|
||||
(when-not (empty? stops)
|
||||
(if (empty? stops)
|
||||
offset
|
||||
(let [stop (first stops)
|
||||
hex-color (:color stop)
|
||||
opacity (:opacity stop)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue