Refactor texture image filtering
- Support only `Linear` or `Nearest` - Simplify `Layer` groups - Move `FilterMethod` to `Image` and `image::Viewer`
This commit is contained in:
parent
75c9afc608
commit
a5125d6fea
12 changed files with 250 additions and 160 deletions
|
|
@ -445,7 +445,11 @@ impl Backend {
|
|||
);
|
||||
}
|
||||
#[cfg(feature = "image")]
|
||||
Primitive::Image { handle, bounds } => {
|
||||
Primitive::Image {
|
||||
handle,
|
||||
filter_method,
|
||||
bounds,
|
||||
} => {
|
||||
let physical_bounds = (*bounds + translation) * scale_factor;
|
||||
|
||||
if !clip_bounds.intersects(&physical_bounds) {
|
||||
|
|
@ -461,8 +465,14 @@ impl Backend {
|
|||
)
|
||||
.post_scale(scale_factor, scale_factor);
|
||||
|
||||
self.raster_pipeline
|
||||
.draw(handle, *bounds, pixels, transform, clip_mask);
|
||||
self.raster_pipeline.draw(
|
||||
handle,
|
||||
*filter_method,
|
||||
*bounds,
|
||||
pixels,
|
||||
transform,
|
||||
clip_mask,
|
||||
);
|
||||
}
|
||||
#[cfg(not(feature = "image"))]
|
||||
Primitive::Image { .. } => {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ impl Pipeline {
|
|||
pub fn draw(
|
||||
&mut self,
|
||||
handle: &raster::Handle,
|
||||
filter_method: raster::FilterMethod,
|
||||
bounds: Rectangle,
|
||||
pixels: &mut tiny_skia::PixmapMut<'_>,
|
||||
transform: tiny_skia::Transform,
|
||||
|
|
@ -39,7 +40,7 @@ impl Pipeline {
|
|||
|
||||
let transform = transform.pre_scale(width_scale, height_scale);
|
||||
|
||||
let quality = match handle.filter().mag {
|
||||
let quality = match filter_method {
|
||||
raster::FilterMethod::Linear => {
|
||||
tiny_skia::FilterQuality::Bilinear
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue