mirror of
https://github.com/penpot/penpot.git
synced 2025-06-04 03:21:38 +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)
|
(let [size (sr-fills/gradient-byte-size gradient)
|
||||||
offset (mem/alloc-bytes size)
|
offset (mem/alloc-bytes size)
|
||||||
heap (mem/get-heap-u32)]
|
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)
|
(case (:type gradient)
|
||||||
:linear
|
:linear
|
||||||
(h/call wasm/internal-module "_add_shape_linear_fill")
|
(h/call wasm/internal-module "_add_shape_linear_fill")
|
||||||
|
@ -273,7 +273,7 @@
|
||||||
(let [size (sr-fills/gradient-byte-size gradient)
|
(let [size (sr-fills/gradient-byte-size gradient)
|
||||||
offset (mem/alloc-bytes size)
|
offset (mem/alloc-bytes size)
|
||||||
heap (mem/get-heap-u32)]
|
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)
|
(case (:type gradient)
|
||||||
:linear
|
:linear
|
||||||
(h/call wasm/internal-module "_add_shape_stroke_linear_fill")
|
(h/call wasm/internal-module "_add_shape_stroke_linear_fill")
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
(let [stops (:stops gradient)]
|
(let [stops (:stops gradient)]
|
||||||
(+ GRADIENT-BASE-SIZE (* (count stops) GRADIENT-STOP-SIZE))))
|
(+ GRADIENT-BASE-SIZE (* (count stops) GRADIENT-STOP-SIZE))))
|
||||||
|
|
||||||
(defn serialize-gradient-fill
|
(defn write-gradient-fill!
|
||||||
[gradient opacity heap offset]
|
[offset heap gradient opacity]
|
||||||
(let [dview (js/DataView. (.-buffer heap))
|
(let [dview (js/DataView. (.-buffer heap))
|
||||||
start-x (:start-x gradient)
|
start-x (:start-x gradient)
|
||||||
start-y (:start-y gradient)
|
start-y (:start-y gradient)
|
||||||
|
@ -26,7 +26,8 @@
|
||||||
(.setFloat32 dview (+ offset 16) opacity true)
|
(.setFloat32 dview (+ offset 16) opacity true)
|
||||||
(.setFloat32 dview (+ offset 20) width true)
|
(.setFloat32 dview (+ offset 20) width true)
|
||||||
(loop [stops (seq stops) offset (+ offset GRADIENT-BASE-SIZE)]
|
(loop [stops (seq stops) offset (+ offset GRADIENT-BASE-SIZE)]
|
||||||
(when-not (empty? stops)
|
(if (empty? stops)
|
||||||
|
offset
|
||||||
(let [stop (first stops)
|
(let [stop (first stops)
|
||||||
hex-color (:color stop)
|
hex-color (:color stop)
|
||||||
opacity (:opacity stop)
|
opacity (:opacity stop)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue