clearly document where this code came from
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
4781e232db
commit
c26ba6437e
1 changed files with 10 additions and 0 deletions
|
@ -357,6 +357,16 @@ impl Service {
|
||||||
} else {
|
} else {
|
||||||
let (exact_width, exact_height) = {
|
let (exact_width, exact_height) = {
|
||||||
// Copied from image::dynimage::resize_dimensions
|
// Copied from image::dynimage::resize_dimensions
|
||||||
|
//
|
||||||
|
// https://github.com/image-rs/image/blob/6edf8ae492c4bb1dacb41da88681ea74dab1bab3/src/math/utils.rs#L5-L11
|
||||||
|
// Calculates the width and height an image should be
|
||||||
|
// resized to. This preserves aspect ratio, and based
|
||||||
|
// on the `fill` parameter will either fill the
|
||||||
|
// dimensions to fit inside the smaller constraint
|
||||||
|
// (will overflow the specified bounds on one axis to
|
||||||
|
// preserve aspect ratio), or will shrink so that both
|
||||||
|
// dimensions are completely contained within the given
|
||||||
|
// `width` and `height`, with empty space on one axis.
|
||||||
let ratio = u64::from(original_width) * u64::from(height);
|
let ratio = u64::from(original_width) * u64::from(height);
|
||||||
let nratio = u64::from(width) * u64::from(original_height);
|
let nratio = u64::from(width) * u64::from(original_height);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue