mirror of
https://github.com/penpot/penpot.git
synced 2025-05-02 00:16:21 +02:00
Merge pull request #6230 from penpot/azazeln28-fix-mem-bytes-alloc-32
🐛 Fix bytes-alloc-32
This commit is contained in:
commit
2e3ed0c23f
2 changed files with 5 additions and 5 deletions
|
@ -215,11 +215,11 @@
|
||||||
(rx/map :body)
|
(rx/map :body)
|
||||||
(rx/mapcat wapi/read-file-as-array-buffer)
|
(rx/mapcat wapi/read-file-as-array-buffer)
|
||||||
(rx/map (fn [image]
|
(rx/map (fn [image]
|
||||||
(let [size (.-byteLength image)
|
(let [size (.-byteLength image)
|
||||||
offset (mem/alloc-bytes size)
|
offset (mem/alloc-bytes size)
|
||||||
heap (mem/get-heap-u8)
|
heap (mem/get-heap-u8)
|
||||||
mem (js/Uint8Array. (.-buffer heap) offset size)]
|
data (js/Uint8Array. image)]
|
||||||
(.set heap mem offset)
|
(.set heap data offset)
|
||||||
(h/call wasm/internal-module "_store_image"
|
(h/call wasm/internal-module "_store_image"
|
||||||
(aget buffer 0)
|
(aget buffer 0)
|
||||||
(aget buffer 1)
|
(aget buffer 1)
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
[size]
|
[size]
|
||||||
(when (= size 0)
|
(when (= size 0)
|
||||||
(js/console.trace "Tried to allocate 0 bytes"))
|
(js/console.trace "Tried to allocate 0 bytes"))
|
||||||
(h/call wasm/internal-module "_alloc_bytes" size))
|
(ptr8->ptr32 (h/call wasm/internal-module "_alloc_bytes" size)))
|
||||||
|
|
||||||
(defn get-heap-u8
|
(defn get-heap-u8
|
||||||
"Returns a Uint8Array view of the heap"
|
"Returns a Uint8Array view of the heap"
|
||||||
|
|
Loading…
Add table
Reference in a new issue