Skip to content

Fix the Eyedropper tool on web with Vello and on desktop with SVG#3886

Merged
Keavon merged 1 commit intomasterfrom
fix-eyedropper-rendering
Mar 11, 2026
Merged

Fix the Eyedropper tool on web with Vello and on desktop with SVG#3886
Keavon merged 1 commit intomasterfrom
fix-eyedropper-rendering

Conversation

@Keavon
Copy link
Member

@Keavon Keavon commented Mar 11, 2026

Closes #2340.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

@Keavon Keavon merged commit 81d0b8b into master Mar 11, 2026
6 checks passed
@Keavon Keavon deleted the fix-eyedropper-rendering branch March 11, 2026 10:26
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refines the Eyedropper tool's functionality, ensuring consistent and accurate behavior across both web (Wasm) and desktop environments, particularly when interacting with different rendering modes like Vello and SVG. It streamlines backend message handling, introduces render mode-aware preview updates, and intelligently adjusts how eyedropper previews are generated based on the platform and chosen rendering technology.

Highlights

  • Unified Eyedropper Preview Rendering: The logic for submitting Eyedropper preview renders has been unified across platforms by removing platform-specific conditional compilation directives from the PortfolioMessage::SubmitEyedropperPreviewRender handler.
  • Render Mode-Aware Eyedropper Preview: The Eyedropper tool's update_cursor_preview function now explicitly considers the current RenderMode, allowing for distinct handling of web-based SVG preview (using frontend rasterization) and Vello-rendered modes (using backend render requests).
  • Platform-Specific Render Mode Adjustment: The submit_eyedropper_preview function in the node graph executor has been adjusted to correctly handle RenderMode::SvgPreview: on desktop, it now falls back to Vello's Normal mode, while on web, it directly utilizes the document's render_mode.
  • Robust Eyedropper Render Handling: Improved robustness for Eyedropper renders by discarding results that do not produce a texture, which is particularly relevant for SVG fallbacks when a GPU is unavailable.
  • SVG Namespace Addition: A custom XML namespace (xmlns:graphite) has been added to the root SVG element generated in the frontend, potentially paving the way for custom SVG elements or attributes.
Changelog
  • editor/src/messages/portfolio/portfolio_message_handler.rs
    • Removed platform-specific conditional compilation for PortfolioMessage::SubmitEyedropperPreviewRender.
  • editor/src/messages/tool/tool_messages/eyedropper_tool.rs
    • Imported RenderMode from graphene_std::vector::style.
    • Modified the update_cursor_preview function signature to accept render_mode.
    • Implemented conditional logic within update_cursor_preview to differentiate between SVG Preview (handled by frontend rasterization on web) and Vello-rendered modes (handled by backend render request).
  • editor/src/node_graph_executor.rs
    • Removed the #[cfg(not(target_family = "wasm"))] attribute from submit_eyedropper_preview, making it universally available.
    • Introduced platform-specific logic to determine the render_mode for eyedropper previews: desktop's SVG Preview now defaults to Normal Vello rendering, while web uses the document's render_mode directly.
  • editor/src/node_graph_executor/runtime.rs
    • Added a new continue statement to discard eyedropper render outputs that do not produce a texture, such as SVG fallbacks without GPU.
  • frontend/src/components/panels/Document.svelte
    • Added the xmlns:graphite="https://graphite.art" attribute to the root SVG element.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes the Eyedropper tool for Vello on web and for SVG mode on desktop. The changes involve unifying the eyedropper message handling across platforms and adding logic to switch between frontend and backend rendering based on the current render mode. On desktop, it adds a fallback from SVG Preview to Normal mode for the eyedropper. The changes look solid and address the issue described. I have one minor suggestion for code conciseness, which remains valid as it does not conflict with any existing rules.

Comment on lines +204 to +213
// TODO: On desktop, SVG Preview mode cannot work with the Eyedropper tool until <https://github.com/GraphiteEditor/Graphite/issues/3796> is implemented.
// TODO: So for now, we fall back to the Eyedropper using Normal mode (Vello) rendering, which looks similar enough to SVG Preview.
#[cfg(not(target_family = "wasm"))]
let render_mode = match document.render_mode {
graphene_std::vector::style::RenderMode::SvgPreview => graphene_std::vector::style::RenderMode::Normal,
other => other,
};
// On web, SVG Preview is handled by the frontend's SVG rasterization path instead, producing the correct result, so we keep it enabled.
#[cfg(target_family = "wasm")]
let render_mode = document.render_mode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This logic for determining the render_mode can be made more concise by using an if expression with cfg!. This avoids separate #[cfg] attributes and repeated let bindings.

Suggested change
// TODO: On desktop, SVG Preview mode cannot work with the Eyedropper tool until <https://github.com/GraphiteEditor/Graphite/issues/3796> is implemented.
// TODO: So for now, we fall back to the Eyedropper using Normal mode (Vello) rendering, which looks similar enough to SVG Preview.
#[cfg(not(target_family = "wasm"))]
let render_mode = match document.render_mode {
graphene_std::vector::style::RenderMode::SvgPreview => graphene_std::vector::style::RenderMode::Normal,
other => other,
};
// On web, SVG Preview is handled by the frontend's SVG rasterization path instead, producing the correct result, so we keep it enabled.
#[cfg(target_family = "wasm")]
let render_mode = document.render_mode;
// TODO: On desktop, SVG Preview mode cannot work with the Eyedropper tool until <https://github.com/GraphiteEditor/Graphite/issues/3796> is implemented.
// TODO: So for now, we fall back to the Eyedropper using Normal mode (Vello) rendering, which looks similar enough to SVG Preview.
// On web, SVG Preview is handled by the frontend's SVG rasterization path instead, producing the correct result, so we keep it enabled.
let render_mode = if cfg!(not(target_family = "wasm")) && document.render_mode == graphene_std::vector::style::RenderMode::SvgPreview {
graphene_std::vector::style::RenderMode::Normal
} else {
document.render_mode
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eyedropper tool doesn't support Vello

1 participant