Perf regression: typoed image filter type
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
a3eb9f7fb1
commit
bb3af85275
1 changed files with 14 additions and 1 deletions
|
@ -141,13 +141,18 @@ fn process_static_image_impl(mut image: DynamicImage, opt: &ImageOptions) -> Dyn
|
|||
return image.resize_exact(96, 96, image::imageops::FilterType::Nearest);
|
||||
}
|
||||
|
||||
let mut use_bilinear = true;
|
||||
|
||||
if opt.emoji == Some(true) {
|
||||
use_bilinear = false;
|
||||
out_dim = clamp_height(out_dim, 128);
|
||||
} else if opt.avatar == Some(true) {
|
||||
use_bilinear = false;
|
||||
out_dim = clamp_height(out_dim, 320);
|
||||
}
|
||||
|
||||
if opt.preview == Some(true) {
|
||||
use_bilinear = false;
|
||||
out_dim = clamp_dimensions(out_dim, 200, 200);
|
||||
}
|
||||
|
||||
|
@ -156,7 +161,15 @@ fn process_static_image_impl(mut image: DynamicImage, opt: &ImageOptions) -> Dyn
|
|||
}
|
||||
|
||||
if out_dim != image.dimensions() {
|
||||
image = image.resize_exact(out_dim.0, out_dim.1, image::imageops::FilterType::Lanczos3);
|
||||
image = image.resize_exact(
|
||||
out_dim.0,
|
||||
out_dim.1,
|
||||
if use_bilinear {
|
||||
image::imageops::FilterType::Triangle
|
||||
} else {
|
||||
image::imageops::FilterType::Nearest
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
image
|
||||
|
|
Loading…
Reference in a new issue