8000 :tada: Serialize as bytes all fill kinds by belen-albeza · Pull Request #6379 · penpot/penpot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

🎉 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

Merged
merged 13 commits into from
May 7, 2025

Conversation

belen-albeza
Copy link
Contributor
@belen-albeza belen-albeza commented Apr 29, 2025

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

Screenshot 2025-05-06 at 12 54 41 PM

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 of 16 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 use repr(C), repr(4) and repr(u8) to control both the alignment and layout, as well as the actual values to serialize the discriminant byte for the enum variant.

Checklist

  • Choose the correct target branch; use develop by default.
  • Provide a brief summary of the changes introduced.
  • Add a detailed explanation of how to reproduce the issue and/or verify the fix, if applicable.
  • Include screenshots or videos, if applicable.
  • Add or modify existing integration tests in case of bugs or new features, if applicable.
  • Check CI passes successfully.
  • Update the CHANGES.md file, referencing the related GitHub issue, if applicable.

@belen-albeza belen-albeza force-pushed the ladybenko-10753-fills-serialization branch from 8c95fc2 to b76a04c Compare May 5, 2025 13:50
@belen-albeza belen-albeza force-pushed the ladybenko-10753-fills-serialization branch from b76a04c to 173d6c2 Compare May 5, 2025 13:51
@belen-albeza belen-albeza force-pushed the ladybenko-10753-fills-serialization branch from 2ab6269 to fc0e81b Compare May 6, 2025 10:58
@belen-albeza belen-albeza marked this pull request as ready for review May 6, 2025 10:59
@belen-albeza belen-albeza force-pushed the ladybenko-10753-fills-serialization branch from fc0e81b to 8609db2 Compare May 6, 2025 11:00
@elenatorro elenatorro self-requested a review May 7, 2025 08:59
(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")
Copy link
Contributor

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?

Copy link
Contributor Author

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

@elenatorro elenatorro merged commit 46709fb into develop May 7, 2025
9 checks passed
@elenatorro elenatorro deleted the ladybenko-10753-fills-serialization branch May 7, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0