Skip to content

Commit d56017a

Browse files
committed
Further cleanup
1 parent e750a9c commit d56017a

File tree

9 files changed

+7
-106
lines changed

9 files changed

+7
-106
lines changed

editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -882,70 +882,6 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
882882
properties: None,
883883
},
884884
#[cfg(feature = "gpu")]
885-
DocumentNodeDefinition {
886-
identifier: "Create GPU Surface",
887-
category: "Debug: GPU",
888-
node_template: NodeTemplate {
889-
document_node: DocumentNode {
890-
implementation: DocumentNodeImplementation::Network(NodeNetwork {
891-
exports: vec![NodeInput::node(NodeId(1), 0)],
892-
nodes: [
893-
DocumentNode {
894-
inputs: vec![NodeInput::scope("editor-api")],
895-
implementation: DocumentNodeImplementation::ProtoNode(wgpu_executor::create_gpu_surface::IDENTIFIER),
896-
..Default::default()
897-
},
898-
DocumentNode {
899-
inputs: vec![NodeInput::node(NodeId(0), 0)],
900-
implementation: DocumentNodeImplementation::ProtoNode(memo::memo::IDENTIFIER),
901-
..Default::default()
902-
},
903-
]
904-
.into_iter()
905-
.enumerate()
906-
.map(|(id, node)| (NodeId(id as u64), node))
907-
.collect(),
908-
..Default::default()
909-
}),
910-
..Default::default()
911-
},
912-
persistent_node_metadata: DocumentNodePersistentMetadata {
913-
output_names: vec!["GPU Surface".to_string()],
914-
network_metadata: Some(NodeNetworkMetadata {
915-
persistent_metadata: NodeNetworkPersistentMetadata {
916-
node_metadata: [
917-
DocumentNodeMetadata {
918-
persistent_metadata: DocumentNodePersistentMetadata {
919-
display_name: "Create GPU Surface".to_string(),
920-
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(0, 0)),
921-
..Default::default()
922-
},
923-
..Default::default()
924-
},
925-
DocumentNodeMetadata {
926-
persistent_metadata: DocumentNodePersistentMetadata {
927-
display_name: "Cache".to_string(),
928-
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(7, 0)),
929-
..Default::default()
930-
},
931-
..Default::default()
932-
},
933-
]
934-
.into_iter()
935-
.enumerate()
936-
.map(|(id, node)| (NodeId(id as u64), node))
937-
.collect(),
938-
..Default::default()
939-
},
940-
..Default::default()
941-
}),
942-
..Default::default()
943-
},
944-
},
945-
description: Cow::Borrowed("TODO"),
946-
properties: None,
947-
},
948-
#[cfg(feature = "gpu")]
949885
DocumentNodeDefinition {
950886
identifier: "Upload Texture",
951887
category: "Debug: GPU",

editor/src/messages/portfolio/portfolio_message_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
366366

367367
let scale = viewport.scale();
368368
// Use exact physical dimensions from browser (via ResizeObserver's devicePixelContentBoxSize)
369-
let physical_resolution = viewport.size().to_physical().into_dvec2().as_uvec2();
369+
let physical_resolution = viewport.size().to_physical().into_dvec2().round().as_uvec2();
370370

371371
if let Ok(message) = self.executor.submit_node_graph_evaluation(
372372
self.documents.get_mut(document_id).expect("Tried to render non-existent document"),

editor/src/node_graph_executor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ impl NodeGraphExecutor {
421421
let matrix = format_transform_matrix(frame.transform);
422422
let transform = if matrix.is_empty() { String::new() } else { format!(" transform=\"{matrix}\"") };
423423
let svg = format!(
424-
r#"<svg><foreignObject width="{}" height="{}"{transform}><div data-canvas-placeholder="{}" data-physical-width="{}" data-physical-height="{}" data-is-viewport="true"></div></foreignObject></svg>"#,
425-
frame.resolution.x, frame.resolution.y, frame.surface_id.0, frame.physical_resolution.x, frame.physical_resolution.y
424+
r#"<svg><foreignObject width="{}" height="{}"{transform}><div data-canvas-placeholder="{}" data-is-viewport="true"></div></foreignObject></svg>"#,
425+
frame.resolution.x, frame.resolution.y, frame.surface_id.0,
426426
);
427427
self.last_svg_canvas = Some(frame);
428428
responses.add(FrontendMessage::UpdateDocumentArtwork { svg });

editor/src/node_graph_executor/runtime.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ impl NodeRuntime {
330330
let frame = graphene_std::application_io::SurfaceFrame {
331331
surface_id: surface.window_id,
332332
resolution: logical_resolution,
333-
physical_resolution,
334333
transform: glam::DAffine2::IDENTITY,
335334
};
336335

frontend/src/components/panels/Document.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@
206206
// Get logical dimensions from foreignObject parent (set by backend)
207207
const foreignObject = placeholder.parentElement;
208208
if (!foreignObject) return;
209-
const logicalWidth = parseInt(foreignObject.getAttribute("width") || "0");
210-
const logicalHeight = parseInt(foreignObject.getAttribute("height") || "0");
209+
const logicalWidth = parseFloat(foreignObject.getAttribute("width") || "0");
210+
const logicalHeight = parseFloat(foreignObject.getAttribute("height") || "0");
211211
212212
// Clone canvas for repeated instances (layers that appear multiple times)
213213
// Viewport canvas is marked with data-is-viewport and should never be cloned

node-graph/interpreted-executor/src/node_registry.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ use graph_craft::proto::{NodeConstructor, TypeErasedBox};
66
use graphene_std::Artboard;
77
use graphene_std::Context;
88
use graphene_std::Graphic;
9-
#[cfg(feature = "gpu")]
10-
use graphene_std::any::DowncastBothNode;
119
use graphene_std::any::DynAnyNode;
1210
use graphene_std::application_io::{ImageTexture, SurfaceFrame};
1311
use graphene_std::brush::brush_cache::BrushCache;
@@ -234,28 +232,6 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
234232
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => path_bool_nodes::BooleanOperation]),
235233
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::text::TextAlign]),
236234
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => RenderIntermediate]),
237-
// =======================
238-
// CREATE GPU SURFACE NODE
239-
// =======================
240-
#[cfg(feature = "gpu")]
241-
(
242-
ProtoNodeIdentifier::new(stringify!(wgpu_executor::CreateGpuSurfaceNode<_>)),
243-
|args| {
244-
Box::pin(async move {
245-
let editor_api: DowncastBothNode<Context, &WasmEditorApi> = DowncastBothNode::new(args[0].clone());
246-
let node = <wgpu_executor::CreateGpuSurfaceNode<_>>::new(editor_api);
247-
let any: DynAnyNode<Context, _, _> = DynAnyNode::new(node);
248-
Box::new(any) as TypeErasedBox
249-
})
250-
},
251-
{
252-
let node = <wgpu_executor::CreateGpuSurfaceNode<_>>::new(graphene_std::any::PanicNode::<Context, dyn_any::DynFuture<'static, &WasmEditorApi>>::new());
253-
let params = vec![fn_type_fut!(Context, &WasmEditorApi)];
254-
let mut node_io = <wgpu_executor::CreateGpuSurfaceNode<_> as NodeIO<'_, Context>>::to_async_node_io(&node, params);
255-
node_io.call_argument = concrete!(<Context as StaticType>::Static);
256-
node_io
257-
},
258-
),
259235
];
260236
// =============
261237
// CONVERT NODES

node-graph/libraries/application-io/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ pub struct SurfaceFrame {
2525
pub surface_id: SurfaceId,
2626
/// Logical resolution in CSS pixels (used for foreignObject dimensions)
2727
pub resolution: DVec2,
28-
/// Physical resolution in device pixels (used for actual canvas/texture dimensions)
29-
pub physical_resolution: UVec2,
3028
pub transform: DAffine2,
3129
}
3230

@@ -109,7 +107,6 @@ impl<S: Size> From<SurfaceHandleFrame<S>> for SurfaceFrame {
109107
surface_id: x.surface_handle.window_id,
110108
transform: x.transform,
111109
resolution: size.into(),
112-
physical_resolution: size,
113110
}
114111
}
115112
}

node-graph/nodes/gstd/src/render_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async fn render<'a: 'n>(ctx: impl Ctx + ExtractFootprint + ExtractVarArgs, edito
133133

134134
let scale = render_params.scale;
135135
let physical_resolution = render_params.footprint.resolution;
136-
let logical_resolution = (render_params.footprint.resolution.as_dvec2() / scale);
136+
let logical_resolution = render_params.footprint.resolution.as_dvec2() / scale;
137137

138138
let RenderIntermediate { ty, mut metadata, contains_artboard } = data;
139139
metadata.apply_transform(footprint.transform);

node-graph/wgpu-executor/src/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub mod texture_conversion;
44

55
use crate::shader_runtime::ShaderRuntime;
66
use anyhow::Result;
7-
use core_types::{Color, Ctx};
7+
use core_types::Color;
88
use dyn_any::StaticType;
99
use futures::lock::Mutex;
1010
use glam::UVec2;
@@ -176,10 +176,3 @@ impl WgpuExecutor {
176176
}
177177

178178
pub type WindowHandle = Arc<SurfaceHandle<Window>>;
179-
180-
#[node_macro::node(skip_impl)]
181-
fn create_gpu_surface<'a: 'n, Io: ApplicationIo<Executor = WgpuExecutor, Surface = Window> + 'a + Send + Sync>(_: impl Ctx + 'a, editor_api: &'a EditorApi<Io>) -> Option<WgpuSurface> {
182-
let canvas = editor_api.application_io.as_ref()?.window()?;
183-
let executor = editor_api.application_io.as_ref()?.gpu_executor()?;
184-
Some(Arc::new(executor.create_surface(canvas).ok()?))
185-
}

0 commit comments

Comments
 (0)