mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-07-08 00:05:00 +00:00
Add Vello support for Outline view mode rendering; add non_scaling to strokes (SVG, not yet Vello) (#2455)
* fix noise pattern parameter issue * removed the commented out line * Fix outline mode stroke width not consistent * add non scaling stroke option * Fix backward compatibility * Clean Debug Message * clean code * clean code 2 * Add vello outline support * Code review --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
3c425d9a71
commit
32aee1ebf9
6 changed files with 185 additions and 121 deletions
|
@ -116,7 +116,13 @@ 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) -> RenderOutputType {
|
||||
async fn render_canvas(
|
||||
render_config: RenderConfig,
|
||||
data: impl GraphicElementRendered,
|
||||
editor: &WasmEditorApi,
|
||||
surface_handle: wgpu_executor::WgpuSurface,
|
||||
render_params: RenderParams,
|
||||
) -> RenderOutputType {
|
||||
use graphene_core::SurfaceFrame;
|
||||
|
||||
let footprint = render_config.viewport;
|
||||
|
@ -129,7 +135,7 @@ async fn render_canvas(render_config: RenderConfig, data: impl GraphicElementRen
|
|||
let mut child = Scene::new();
|
||||
|
||||
let mut context = wgpu_executor::RenderContext::default();
|
||||
data.render_to_vello(&mut child, Default::default(), &mut context);
|
||||
data.render_to_vello(&mut child, Default::default(), &mut context, &render_params);
|
||||
|
||||
// TODO: Instead of applying the transform here, pass the transform during the translation to avoid the O(n) cost
|
||||
scene.append(&child, Some(kurbo::Affine::new(footprint.transform.to_cols_array())));
|
||||
|
@ -270,7 +276,7 @@ async fn render<'a: 'n, T: 'n + GraphicElementRendered + WasmNotSend>(
|
|||
if use_vello && editor_api.application_io.as_ref().unwrap().gpu_executor().is_some() {
|
||||
#[cfg(all(feature = "vello", target_arch = "wasm32"))]
|
||||
return RenderOutput {
|
||||
data: render_canvas(render_config, data, editor_api, surface_handle.unwrap()).await,
|
||||
data: render_canvas(render_config, data, editor_api, surface_handle.unwrap(), render_params).await,
|
||||
metadata,
|
||||
};
|
||||
#[cfg(not(all(feature = "vello", target_arch = "wasm32")))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue