Skip to content

feat: support tiny-skia CPU backend#23

Merged
donkeyteethUX merged 4 commits into
donkeyteethUX:mainfrom
zao111222333:main
May 1, 2026
Merged

feat: support tiny-skia CPU backend#23
donkeyteethUX merged 4 commits into
donkeyteethUX:mainfrom
zao111222333:main

Conversation

@zao111222333
Copy link
Copy Markdown
Contributor

Summary

I introduce PlotRenderStrategy to switch between the existing shader path and a new canvas-based path for CPU
renderers like tiny-skia. The strategy can be configured manually or auto-detected from the active iced graphics
backend. The shared plot update/draw implementation is reused by both shader and canvas programs, and CPU picking is used when rendering through canvas.

I also add examples/auto_backend.rs, which auto-detects the render strategy, displays the current strategy, and
provides x/y layout offset sliders for testing PlotWidget behavior under different backends.

Known issue

When running with:

ICED_BACKEND="tiny-skia" cargo run --example auto_backend

PlotWidget may show corrupted canvas content after applying layout offsets. This is an iced 0.14 tiny-skia/canvas
issue, not a PlotWidget rendering bug.

The issue is already fixed in iced 0.15.0-dev, which can be verified here:

https://github.com/zao111222333/iced_plot/tree/iced-0.15.0-dev

That branch only upgrades iced, and the offset corruption disappears.

Copy link
Copy Markdown
Owner

@donkeyteethUX donkeyteethUX left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on!

It looks good. All the examples I tried worked fine with tiny-skia except for huge_scatter (which is not surprising). Just a few small requests.

Comment thread Cargo.toml Outdated
Comment thread src/plot_widget.rs Outdated
Comment thread src/plot_widget.rs Outdated
Comment thread src/plot_widget.rs Outdated
@zao111222333
Copy link
Copy Markdown
Contributor Author

Thank you for reviewing! I have made revisions based on your suggestions.

@donkeyteethUX donkeyteethUX merged commit c21d85c into donkeyteethUX:main May 1, 2026
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.

2 participants