-
8000
-
Notifications
You must be signed in to change notification settings - Fork 2k
🎉 Serialize as bytes all fill kinds #6379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8c95fc2
to
b76a04c
Compare
b76a04c
to
173d6c2
Compare
2ab6269
to
fc0e81b
Compare
fc0e81b
to
8609db2
Compare
(dm/get-prop image :width) | ||
(dm/get-prop image :height)) | ||
(sr-fills/write-image-fill! offset heap id opacity (dm/get-prop image :width) (dm/get-prop image :height)) | ||
(h/call wasm/internal-module "_add_shape_fill") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're calling "_add_shape_fill" for all fill types, maybe we can just call it once at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried and it turns out we need to call _add_shape_fill
before (store-image)
:( I did remove the redundant calls in gradients
Related Ticket
https://tree.taiga.io/project/penpot/task/10753
How to test
Open or create a file with different fill types (also fills for strokes).
Summary
This creates a unified DTO to deserialize in Wasm fill data. Now all fills have the same size count (
160
bytes) and gradients have a cap of16
stops.We switched to use
mem::transmute
to do deserialization (it is a raw byte copy). To be able to do that, we need to userepr(C)
,repr(4)
andrepr(u8)
to control both the alignment and layout, as well as the actual values to serialize the discriminant byte for the enum variant.Checklist
develop
by default.Add or modify existing integration tests in case of bugs or new features, if applicable.Update theCHANGES.md
file, referencing the related GitHub issue, if applicable.