Correctly set the dimensions of the SVG foreignObject container for the Vello canvas (#1907)

* Correctly set the dimensons of the forgein object element

* Remove dead code

* Fix missing default impl

* Set correct default for not wasm32 targets as well
This commit is contained in:
Dennis Kobert 2024-08-06 10:41:56 +02:00 committed by GitHub
parent f21c8c1b17
commit 00864e274f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 20 deletions

View file

@ -110,6 +110,8 @@ fn render_svg(data: impl GraphicElementRendered, mut render: SvgRender, render_p
#[cfg(feature = "vello")]
#[cfg_attr(not(target_arch = "wasm32"), allow(dead_code))]
async fn render_canvas(render_config: RenderConfig, data: impl GraphicElementRendered, editor: &WasmEditorApi, surface_handle: wgpu_executor::WgpuSurface) -> RenderOutput {
use graphene_core::SurfaceFrame;
if let Some(exec) = editor.application_io.as_ref().unwrap().gpu_executor() {
use vello::*;
@ -129,11 +131,12 @@ async fn render_canvas(render_config: RenderConfig, data: impl GraphicElementRen
} else {
unreachable!("Attempted to render with Vello when no GPU executor is available");
}
let frame = graphene_core::application_io::SurfaceHandleFrame {
surface_handle,
let frame = SurfaceFrame {
surface_id: surface_handle.window_id,
resolution: render_config.viewport.resolution,
transform: glam::DAffine2::IDENTITY,
};
RenderOutput::CanvasFrame(frame.into())
RenderOutput::CanvasFrame(frame)
}
#[cfg(target_arch = "wasm32")]