Merge pull request #6449 from penpot/superalex-add-shapes-buffer

🎉 Add shapes buffer to improve memory allocation
This commit is contained in:
Aitor Moreno 2025-05-12 10:23:34 +02:00 committed by GitHub
commit 69062f03ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 122 additions and 36 deletions

View file

@ -842,9 +842,12 @@
(defn initialize
[base-objects zoom vbox background]
(let [rgba (sr-clr/hex->u32argb background 1)]
(let [rgba (sr-clr/hex->u32argb background 1)
shapes (into [] (vals base-objects))
total-shapes (count shapes)]
(h/call wasm/internal-module "_set_canvas_background" rgba)
(h/call wasm/internal-module "_set_view" zoom (- (:x vbox)) (- (:y vbox)))
(h/call wasm/internal-module "_init_shapes_pool" total-shapes)
(set-objects base-objects)))
(def ^:private canvas-options