Skip to content

Conversation

@semiversus
Copy link
Contributor

@semiversus semiversus commented May 22, 2025

This pull request fixes two issues when tiny-skia is used and DPI scaling factor is unequal to 1.0.

Changes done to fix these issues:

  • Vector pipeline .draw gets physical_bounds but needs *bounds
  • The SVG is rendered with size defined by logical size and then the pixmap is scaled up. Change this to rendering in physical size.
  • Arguments with _ prefix get the prefix removed, as the arguments are used.

Fixes #2825.

@semiversus semiversus changed the title Fix scaling artifacts Fix SVG artifacts when using tiny-skia and DPI scaling May 22, 2025
@semiversus
Copy link
Contributor Author

Using the minimal repo from @njust (https://github.com/njust/iced-svg-issue) here are the results:

Scale 1.0
scale_1 0

Scale 2.0 (with original 1.13.1)
scale_2 0_fail

Scale 2.0 with this fix
scale_2 0_working

@semiversus semiversus mentioned this pull request May 31, 2025
2 tasks
@hecrj hecrj force-pushed the fix_scaling_artifacts branch from f2fc057 to 827e114 Compare November 25, 2025 23:22
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Thanks!

I'm fairly sure this breaks rotation, but it's better than the current implementation.

Also, the _ prefix is needed because both the image and svg features may be disabled.

@hecrj hecrj force-pushed the fix_scaling_artifacts branch from 827e114 to 8cae3fc Compare November 25, 2025 23:23
@hecrj hecrj changed the title Fix SVG artifacts when using tiny-skia and DPI scaling Fix svg scaling in iced_tiny_skia Nov 25, 2025
@hecrj hecrj added this to the 0.14 milestone Nov 25, 2025
@hecrj hecrj added bug Something isn't working rendering svg fix labels Nov 25, 2025
@hecrj hecrj enabled auto-merge November 25, 2025 23:25
@hecrj hecrj merged commit 9de2261 into iced-rs:master Nov 25, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fix rendering svg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SVG DPI scaling issue with tiny-skia

2 participants