Skip to content

Commit

Permalink
Minor codestyle / doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaj committed Feb 4, 2018
1 parent 7a7b5f1 commit d2491b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/dynimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ impl DynamicImage {
/// Returns a new image. The image's aspect ratio is preserved.
/// The image is scaled to the maximum possible size that fits
/// within the bounds specified by ```nwidth``` and ```nheight```.
///
/// This method uses a fast integer algorithm where each source
/// pixel contributes to exactly one target pixel.
/// May give aliasing artifacts if new size is close to old size.
Expand Down
8 changes: 2 additions & 6 deletions src/imageops/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ fn horizontal_sample<I, P, S>(image: &I, new_width: u32,
let (width, height) = image.dimensions();
let mut out = ImageBuffer::new(new_width, height);

let max = S::max_value();
let max: f32 = NumCast::from(max).unwrap();

let max: f32 = NumCast::from(KTHS::max_value()).unwrap();

This comment has been minimized.

Copy link
@calum

calum Apr 18, 2018

Contributor

#753 This line is the first time I can find KTHS being used.

This comment has been minimized.

Copy link
@calum

calum Apr 18, 2018

Contributor

I think it is supposed to be S::max_value() where S is the sub pixel type.
Created PR #754.

let ratio = width as f32 / new_width as f32;
let sratio = if ratio < 1.0 { 1.0 } else { ratio };
let src_support = filter.support * sratio;
Expand Down Expand Up @@ -220,9 +218,7 @@ fn vertical_sample<I, P, S>(image: &I, new_height: u32,
let (width, height) = image.dimensions();
let mut out = ImageBuffer::new(width, new_height);

let max = S::max_value();
let max: f32 = NumCast::from(max).unwrap();

let max: f32 = NumCast::from(S::max_value()).unwrap();
let ratio = height as f32 / new_height as f32;
let sratio = if ratio < 1.0 { 1.0 } else { ratio };
let src_support = filter.support * sratio;
Expand Down

0 comments on commit d2491b7

Please sign in to comment.