Instance tables refactor part 1: wrap graphical data in the new Instances<T> struct (#2230)

* Port VectorData to Instances<VectorData>

* Port ImageFrame<P> and TextureFrame to Instances<ImageFrame<P>> and Instances<TextureFrame>

* Avoid mutation with the TransformMut trait

* Port GraphicGroup to Instances<GraphicGroup>

* It compiles!

* Organize debugging

* Document upgrading

* Fix Brush node

* Restore TransformMut in lieu of TransformSet trait

* Fix tests

* Final code review
This commit is contained in:
Keavon Chambers 2025-01-28 23:51:12 -08:00 committed by GitHub
parent 408f9bffa1
commit eb0ff20d3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 1855 additions and 1221 deletions

View file

@ -825,7 +825,7 @@ mod tests {
fn test_node_with_implementations() {
let attr = quote!(category("Raster: Adjustment"));
let input = quote!(
fn levels<P: Pixel>(image: ImageFrame<P>, #[implementations(f32, f64)] shadows: f64) -> ImageFrame<P> {
fn levels<P: Pixel>(image: ImageFrameTable<P>, #[implementations(f32, f64)] shadows: f64) -> ImageFrameTable<P> {
// Implementation details...
}
);
@ -846,10 +846,10 @@ mod tests {
where_clause: None,
input: Input {
pat_ident: pat_ident("image"),
ty: parse_quote!(ImageFrame<P>),
ty: parse_quote!(ImageFrameTable<P>),
implementations: Punctuated::new(),
},
output_type: parse_quote!(ImageFrame<P>),
output_type: parse_quote!(ImageFrameTable<P>),
is_async: false,
fields: vec![ParsedField::Regular {
pat_ident: pat_ident("shadows"),
@ -939,7 +939,7 @@ mod tests {
fn test_async_node() {
let attr = quote!(category("IO"));
let input = quote!(
async fn load_image(api: &WasmEditorApi, #[expose] path: String) -> ImageFrame<Color> {
async fn load_image(api: &WasmEditorApi, #[expose] path: String) -> ImageFrameTable<Color> {
// Implementation details...
}
);
@ -963,7 +963,7 @@ mod tests {
ty: parse_quote!(&WasmEditorApi),
implementations: Punctuated::new(),
},
output_type: parse_quote!(ImageFrame<Color>),
output_type: parse_quote!(ImageFrameTable<Color>),
is_async: true,
fields: vec![ParsedField::Regular {
pat_ident: pat_ident("path"),
@ -1077,7 +1077,7 @@ mod tests {
fn test_invalid_implementation_syntax() {
let attr = quote!(category("Test"));
let input = quote!(
fn test_node(_: (), #[implementations((Footprint, Color), (Footprint, ImageFrame<Color>))] input: impl Node<Footprint, Output = T>) -> T {
fn test_node(_: (), #[implementations((Footprint, Color), (Footprint, ImageFrameTable<Color>))] input: impl Node<Footprint, Output = T>) -> T {
// Implementation details...
}
);
@ -1103,10 +1103,10 @@ mod tests {
#[implementations((), #tuples, Footprint)] footprint: F,
#[implementations(
() -> Color,
() -> ImageFrame<Color>,
() -> ImageFrameTable<Color>,
() -> GradientStops,
Footprint -> Color,
Footprint -> ImageFrame<Color>,
Footprint -> ImageFrameTable<Color>,
Footprint -> GradientStops,
)]
image: impl Node<F, Output = T>,