Merge pull request #6491 from penpot/alotor-perf-pixel-precision

 Pixel precision for new renderer
This commit is contained in:
Aitor Moreno 2025-05-22 11:37:11 +02:00 committed by GitHub
commit 58b1cf6b0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 76 additions and 22 deletions

View file

@ -654,9 +654,10 @@
(let [offset (h/call wasm/internal-module "_get_text_dimensions")
heapf32 (mem/get-heap-f32)
width (aget heapf32 (mem/ptr8->ptr32 offset))
height (aget heapf32 (mem/ptr8->ptr32 (+ offset 4)))]
height (aget heapf32 (mem/ptr8->ptr32 (+ offset 4)))
max-width (aget heapf32 (mem/ptr8->ptr32 (+ offset 8)))]
(h/call wasm/internal-module "_free_bytes")
{:width width :height height})))
{:width width :height height :max-width max-width})))
(defn set-view-box
[zoom vbox]
@ -803,7 +804,7 @@
(h/call wasm/internal-module "_set_structure_modifiers"))))
(defn propagate-modifiers
[entries]
[entries pixel-precision]
(when (d/not-empty? entries)
(let [offset (mem/alloc-bytes-32 (modifier-get-entries-size entries))
heapf32 (mem/get-heap-f32)
@ -817,7 +818,7 @@
(sr/heapf32-set-matrix transform heapf32 (+ current-offset (mem/ptr8->ptr32 MODIFIER-ENTRY-TRANSFORM-OFFSET)))
(recur (rest entries) (+ current-offset (mem/ptr8->ptr32 MODIFIER-ENTRY-SIZE))))))
(let [result-offset (h/call wasm/internal-module "_propagate_modifiers")
(let [result-offset (h/call wasm/internal-module "_propagate_modifiers" pixel-precision)
heapf32 (mem/get-heap-f32)
heapu32 (mem/get-heap-u32)
len (aget heapu32 (mem/ptr8->ptr32 result-offset))
@ -829,7 +830,7 @@
result))))
(defn propagate-apply
[entries]
[entries pixel-precision]
(when (d/not-empty? entries)
(let [offset (mem/alloc-bytes-32 (modifier-get-entries-size entries))
heapf32 (mem/get-heap-f32)
@ -843,7 +844,7 @@
(sr/heapf32-set-matrix transform heapf32 (+ current-offset (mem/ptr8->ptr32 MODIFIER-ENTRY-TRANSFORM-OFFSET)))
(recur (rest entries) (+ current-offset (mem/ptr8->ptr32 MODIFIER-ENTRY-SIZE))))))
(let [offset (h/call wasm/internal-module "_propagate_apply")
(let [offset (h/call wasm/internal-module "_propagate_apply" pixel-precision)
heapf32 (mem/get-heap-f32)
width (aget heapf32 (mem/ptr8->ptr32 (+ offset 0)))
height (aget heapf32 (mem/ptr8->ptr32 (+ offset 4)))