Skip to content

Commit

Permalink
Skia: Fix quality of control rendering when using `cache-rendering-hi…
Browse files Browse the repository at this point in the history
…nt: true;`

By default, render layers with smooth scaling, just like we do also in `Image` by default.

The easiest way to reproduce the issue is to use `cache-rendering-hint: true;` on an `Image` and then scale it: It'll appear as if `image-rendering: pixelated;` is used, which it shouldn't.

`cache-rendering-hint: true;` on an `Image` doesn't make much sense by itself, but it should be a no-op.
  • Loading branch information
tronical committed May 15, 2024
1 parent a3d4112 commit b4fc512
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/renderers/skia/itemrenderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,12 @@ impl<'a> SkiaItemRenderer<'a> {
}) {
let mut tint = skia_safe::Paint::default();
tint.set_alpha_f(self.current_state.alpha);
self.canvas.draw_image(layer_image, skia_safe::Point::default(), Some(&tint));
self.canvas.draw_image_with_sampling_options(
layer_image,
skia_safe::Point::default(),
skia_safe::sampling_options::FilterMode::Linear,
Some(&tint),
);
}
RenderingResult::ContinueRenderingWithoutChildren
}
Expand Down

0 comments on commit b4fc512

Please sign in to comment.