mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 03:18:06 +08:00
Upgrade several Rust dependencies (#1613)
`specta` from Hypercube's fork commit to latest upstream commit `wasm-bindgen` 0.2.87 -> 0.2.91 `spirv-std` from 0.9 to not-yet-merged commit in https://github.com/EmbarkStudios/rust-gpu/pull/1115 `wgpu` 0.17 -> 0.19 `winit` 0.28.6 -> 0.29 `vello` and `vello_svg` from latest upstream commit to not-yet-merged commit in https://github.com/linebender/vello/pull/427 `resvg` 0.36.0 -> 0.39 `glam` 0.24 -> 0.25 `rustybuzz` 0.8.0 -> 0.10.0 `js-sys` and `web-sys` 0.3.55 -> 0.3.67 `usvg` 0.36.0 -> 0.39 `spirv` 0.2.0 -> 0.3 * Update a couple of dependencies * More test fixing… * Use upstream Specta instead of fork * Update comments in Cargo.toml --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -5,31 +5,26 @@
|
||||
#[test]
|
||||
fn generate_ts_types() {
|
||||
use crate::messages::prelude::FrontendMessage;
|
||||
use specta::{
|
||||
ts::{export_datatype, BigIntExportBehavior, ExportConfiguration},
|
||||
DefOpts, NamedType, Type, TypeDefs,
|
||||
};
|
||||
use specta::ts::{export_named_datatype, BigIntExportBehavior, ExportConfig};
|
||||
use specta::{NamedType, TypeMap};
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
|
||||
let config = ExportConfiguration::new().bigint(BigIntExportBehavior::Number);
|
||||
let config = ExportConfig::new().bigint(BigIntExportBehavior::Number);
|
||||
|
||||
let mut type_map = TypeDefs::new();
|
||||
let mut type_map = TypeMap::default();
|
||||
|
||||
let datatype = FrontendMessage::named_data_type(
|
||||
DefOpts {
|
||||
parent_inline: false,
|
||||
type_map: &mut type_map,
|
||||
},
|
||||
&FrontendMessage::definition_generics().into_iter().map(Into::into).collect::<Vec<_>>(),
|
||||
)
|
||||
.unwrap();
|
||||
let datatype = FrontendMessage::definition_named_data_type(&mut type_map);
|
||||
|
||||
let mut export = String::new();
|
||||
|
||||
export += &export_datatype(&config, &datatype).unwrap();
|
||||
export += &export_named_datatype(&config, &datatype, &type_map).unwrap();
|
||||
|
||||
type_map.values().flatten().flat_map(|v| export_datatype(&config, v)).for_each(|e| export += &format!("\n\n{e}"));
|
||||
type_map
|
||||
.iter()
|
||||
.map(|(_, v)| v)
|
||||
.flat_map(|v| export_named_datatype(&config, v, &type_map))
|
||||
.for_each(|e| export += &format!("\n\n{e}"));
|
||||
|
||||
let mut file = File::create("../types.ts").unwrap();
|
||||
|
||||
|
||||
@@ -457,8 +457,9 @@ impl WidgetHolder {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, specta::Type)]
|
||||
pub struct WidgetCallback<T> {
|
||||
#[specta(skip)]
|
||||
pub callback: Arc<dyn Fn(&T) -> Message + 'static + Send + Sync>,
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ pub enum Message {
|
||||
|
||||
/// Provides an impl of `specta::Type` for `MessageDiscriminant`, the struct created by `impl_message`.
|
||||
/// Specta isn't integrated with `impl_message`, so a remote impl must be provided using this struct.
|
||||
#[derive(specta::Type)]
|
||||
#[specta(inline, remote = "MessageDiscriminant")]
|
||||
pub struct MessageDiscriminantDef(pub u8);
|
||||
impl specta::Type for MessageDiscriminant {
|
||||
fn inline(_type_map: &mut specta::TypeMap, _generics: specta::Generics) -> specta::DataType {
|
||||
specta::DataType::Any
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ use graphene_core::{Artboard, Color};
|
||||
use transform_utils::LayerBounds;
|
||||
|
||||
use glam::{DAffine2, DVec2, IVec2};
|
||||
use usvg::NodeExt;
|
||||
|
||||
pub mod transform_utils;
|
||||
|
||||
@@ -761,7 +760,6 @@ impl MessageHandler<GraphOperationMessage, GraphOperationHandlerData<'_>> for Gr
|
||||
parent,
|
||||
insert_index,
|
||||
} => {
|
||||
use usvg::TreeParsing;
|
||||
let tree = match usvg::Tree::from_str(&svg, &usvg::Options::default()) {
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
@@ -774,7 +772,7 @@ impl MessageHandler<GraphOperationMessage, GraphOperationHandlerData<'_>> for Gr
|
||||
};
|
||||
let mut modify_inputs = ModifyInputsContext::new(document_network, document_metadata, node_graph, responses);
|
||||
|
||||
import_usvg_node(&mut modify_inputs, &tree.root, transform, id, parent, insert_index);
|
||||
import_usvg_node(&mut modify_inputs, &usvg::Node::Group(Box::new(tree.root)), transform, id, parent, insert_index);
|
||||
load_network_structure(document_network, document_metadata, selected_nodes, collapsed);
|
||||
}
|
||||
}
|
||||
@@ -803,14 +801,14 @@ fn import_usvg_node(modify_inputs: &mut ModifyInputsContext, node: &usvg::Node,
|
||||
return;
|
||||
};
|
||||
modify_inputs.layer_node = Some(layer);
|
||||
match &*node.borrow() {
|
||||
usvg::NodeKind::Group(_group) => {
|
||||
for child in node.children() {
|
||||
match node {
|
||||
usvg::Node::Group(group) => {
|
||||
for child in &group.children {
|
||||
import_usvg_node(modify_inputs, &child, transform, NodeId(generate_uuid()), LayerNodeIdentifier::new_unchecked(layer), -1);
|
||||
}
|
||||
modify_inputs.layer_node = Some(layer);
|
||||
}
|
||||
usvg::NodeKind::Path(path) => {
|
||||
usvg::Node::Path(path) => {
|
||||
let subpaths = convert_usvg_path(path);
|
||||
let bounds = subpaths.iter().filter_map(|subpath| subpath.bounding_box()).reduce(Quad::combine_bounds).unwrap_or_default();
|
||||
let transformed_bounds = subpaths
|
||||
@@ -836,10 +834,10 @@ fn import_usvg_node(modify_inputs: &mut ModifyInputsContext, node: &usvg::Node,
|
||||
);
|
||||
apply_usvg_stroke(&path.stroke, modify_inputs);
|
||||
}
|
||||
usvg::NodeKind::Image(_image) => {
|
||||
usvg::Node::Image(_image) => {
|
||||
warn!("Skip image")
|
||||
}
|
||||
usvg::NodeKind::Text(text) => {
|
||||
usvg::Node::Text(text) => {
|
||||
let font = Font::new(crate::consts::DEFAULT_FONT_FAMILY.to_string(), crate::consts::DEFAULT_FONT_STYLE.to_string());
|
||||
modify_inputs.insert_text(text.chunks.iter().map(|chunk| chunk.text.clone()).collect(), font, 24., layer);
|
||||
modify_inputs.fill_set(Fill::Solid(Color::BLACK));
|
||||
|
||||
@@ -1490,7 +1490,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
|
||||
name: "Render Texture".to_string(),
|
||||
inputs: vec![
|
||||
NodeInput::Network(concrete!(ShaderInputFrame<WgpuExecutor>)),
|
||||
NodeInput::Network(concrete!(Arc<SurfaceHandle<<WgpuExecutor as GpuExecutor>::Surface>>)),
|
||||
NodeInput::Network(concrete!(Arc<SurfaceHandle<<WgpuExecutor as GpuExecutor>::Surface<'_>>>)),
|
||||
NodeInput::node(NodeId(0), 0),
|
||||
],
|
||||
implementation: DocumentNodeImplementation::Unresolved(ProtoNodeIdentifier::new("gpu_executor::RenderTextureNode<_, _>")),
|
||||
|
||||
@@ -19,6 +19,7 @@ pub fn empty_provider() -> OverlayProvider {
|
||||
pub struct OverlayContext {
|
||||
// Serde functionality isn't used but is required by the message system macros
|
||||
#[serde(skip, default = "overlay_canvas_context")]
|
||||
#[specta(skip)]
|
||||
pub render_context: web_sys::CanvasRenderingContext2d,
|
||||
pub size: DVec2,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user