mirror of
https://github.com/penpot/penpot.git
synced 2025-07-13 08:47:16 +02:00
Merge pull request #6623 from penpot/ladybenko-11106-send-all-fills
✨ Send all fills of a shape in a single wasm call
This commit is contained in:
commit
bbac5d050e
3 changed files with 43 additions and 20 deletions
|
@ -495,6 +495,10 @@ impl Shape {
|
|||
self.fills.iter()
|
||||
}
|
||||
|
||||
pub fn set_fills(&mut self, fills: Vec<Fill>) {
|
||||
self.fills = fills;
|
||||
}
|
||||
|
||||
pub fn add_fill(&mut self, f: Fill) {
|
||||
self.fills.push(f);
|
||||
}
|
||||
|
|
|
@ -63,6 +63,15 @@ pub fn parse_fills_from_bytes(buffer: &[u8], num_fills: usize) -> Vec<shapes::Fi
|
|||
.collect()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn set_shape_fills() {
|
||||
with_current_shape!(state, |shape: &mut Shape| {
|
||||
let bytes = mem::bytes();
|
||||
let fills = parse_fills_from_bytes(&bytes, bytes.len() / RAW_FILL_DATA_SIZE);
|
||||
shape.set_fills(fills);
|
||||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn add_shape_fill() {
|
||||
with_current_shape!(state, |shape: &mut Shape| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue