mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Desktop: Fix non-Vello render mode (#3259)
* fix non vello render mode * move export overide desision from reneder node to node runtime * fix * cleanup * Fix typo and cleanup export logic --------- Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
@@ -146,7 +146,7 @@ impl NodeGraphExecutor {
|
||||
},
|
||||
time,
|
||||
#[cfg(any(feature = "resvg", feature = "vello"))]
|
||||
export_format: graphene_std::application_io::ExportFormat::Canvas,
|
||||
export_format: graphene_std::application_io::ExportFormat::Raster,
|
||||
#[cfg(not(any(feature = "resvg", feature = "vello")))]
|
||||
export_format: graphene_std::application_io::ExportFormat::Svg,
|
||||
render_mode: document.render_mode,
|
||||
@@ -190,10 +190,10 @@ impl NodeGraphExecutor {
|
||||
let size = bounds[1] - bounds[0];
|
||||
let transform = DAffine2::from_translation(bounds[0]).inverse();
|
||||
|
||||
let export_format = if export_config.file_type == FileType::Svg || cfg!(not(feature = "gpu")) {
|
||||
let export_format = if export_config.file_type == FileType::Svg {
|
||||
graphene_std::application_io::ExportFormat::Svg
|
||||
} else {
|
||||
graphene_std::application_io::ExportFormat::Texture
|
||||
graphene_std::application_io::ExportFormat::Raster
|
||||
};
|
||||
|
||||
let render_config = RenderConfig {
|
||||
|
||||
@@ -7,7 +7,7 @@ use graph_craft::graphene_compiler::Compiler;
|
||||
use graph_craft::proto::GraphErrors;
|
||||
use graph_craft::wasm_application_io::EditorPreferences;
|
||||
use graph_craft::{ProtoNodeIdentifier, concrete};
|
||||
use graphene_std::application_io::{ApplicationIo, ImageTexture, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig};
|
||||
use graphene_std::application_io::{ApplicationIo, ExportFormat, ImageTexture, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig};
|
||||
use graphene_std::bounds::RenderBoundingBox;
|
||||
use graphene_std::memo::IORecord;
|
||||
use graphene_std::ops::Convert;
|
||||
@@ -212,7 +212,19 @@ impl NodeRuntime {
|
||||
|
||||
self.sender.send_generation_response(CompilationResponse { result, node_graph_errors });
|
||||
}
|
||||
GraphRuntimeRequest::ExecutionRequest(ExecutionRequest { execution_id, render_config, .. }) => {
|
||||
GraphRuntimeRequest::ExecutionRequest(ExecutionRequest { execution_id, mut render_config, .. }) => {
|
||||
// There are cases where we want to export via the svg pipeline eventhough raster was requested.
|
||||
if matches!(render_config.export_format, ExportFormat::Raster) {
|
||||
let vello_available = self.editor_api.application_io.as_ref().unwrap().gpu_executor().is_some();
|
||||
let use_vello = vello_available && self.editor_api.editor_preferences.use_vello();
|
||||
|
||||
// On web when the user has disabled vello rendering in the preferences or we are exporting.
|
||||
// And on all platforms when vello is not supposed to be used.
|
||||
if !use_vello || cfg!(target_family = "wasm") && render_config.for_export {
|
||||
render_config.export_format = ExportFormat::Svg;
|
||||
}
|
||||
}
|
||||
|
||||
let result = self.execute_network(render_config).await;
|
||||
let mut responses = VecDeque::new();
|
||||
// TODO: Only process monitor nodes if the graph has changed, not when only the Footprint changes
|
||||
|
||||
Reference in New Issue
Block a user