* imgproc: Don't upscale images in the Fit op, fix #1542 * imgproc: Remove FIXMEs that have been addressed
This commit is contained in:
parent
96e28ddd5c
commit
6f22132b8d
|
@ -139,6 +139,10 @@ impl ResizeOp {
|
|||
res.resize((w as u32, h))
|
||||
}
|
||||
Fit(w, h) => {
|
||||
if orig_w <= w && orig_h <= h {
|
||||
return res; // ie. no-op
|
||||
}
|
||||
|
||||
let orig_w_h = orig_w as u64 * h as u64;
|
||||
let orig_h_w = orig_h as u64 * w as u64;
|
||||
|
||||
|
@ -220,7 +224,7 @@ impl Format {
|
|||
}
|
||||
"jpeg" | "jpg" => Ok(Jpeg(jpg_quality)),
|
||||
"png" => Ok(Png),
|
||||
"webp" => Ok(WebP(quality)), // FIXME: this is undoc'd
|
||||
"webp" => Ok(WebP(quality)),
|
||||
_ => Err(format!("Invalid image format: {}", format).into()),
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +346,6 @@ impl ImageOp {
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: Explain this in the doc
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct EnqueueResponse {
|
||||
/// The final URL for that asset
|
||||
|
|
|
@ -95,6 +95,11 @@ fn resize_image_fit2() {
|
|||
image_op_test("jpg.jpg", "fit", Some(160), Some(180), "auto", "jpg", 142, 180, 300, 380);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resize_image_fit3() {
|
||||
image_op_test("jpg.jpg", "fit", Some(400), Some(400), "auto", "jpg", 300, 380, 300, 380);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resize_image_fill1() {
|
||||
image_op_test("jpg.jpg", "fill", Some(100), Some(200), "auto", "jpg", 100, 200, 300, 380);
|
||||
|
|
Loading…
Reference in a new issue