message: optimize image resizing by caching calls to filter.kernel
diff: @@ -135,13 +135,13 @@ where
  {
  let (width, height) = image.dimensions();
  let mut out = ImageBuffer::new(new_width, height);
  + let mut ws = Vec::new();
  let max: f32 = NumCast::from(S::max_value()).unwrap();
  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;
  - for y in 0..height {
  for outx in 0..new_width {
  // Find the point in the input image corresponding to the centre
  // of the current pixel in the output image.
  @@ -167,15 +167,19 @@ where
  // below, as the kernel treats the centre of a pixel as 0.
  let inputx = inputx - 0.5;
  + ws.clear();
  let mut sum = 0.0;
  -
  - let mut t = (0.0, 0.0, 0.0, 0.0);
  -
  for i in left..right {
  let w = (filter.kernel)((i as f32 - inputx) / sratio);
  + ws.push(w);
  sum += w;
  + }
  +
  + for y in 0..height {
  + let mut t = (0.0, 0.0, 0.0, 0.0);
  - let p = image.get_pixel(i, y);
  + for (i, w) in ws.iter().enumerate() {
  + let p = image.get_pixel(left + i as u32, y);
  let (k1, k2, k3, k4) = p.channels4();
  let vec: (f32, f32, f32, f32) = (
  @@ -223,13 +227,13 @@ where
  {
  let (width, height) = image.dimensions();
  let mut out = ImageBuffer::new(width, new_height);
  + let mut ws = Vec::new();
  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;
  - for x in 0..width {
  for outy in 0..new_height {
  // For an explanation of this algorithm, see the comments
  // in horizontal_sample.
  @@ -247,15 +251,19 @@ where
  let inputy = inputy - 0.5;
  + ws.clear();
  let mut sum = 0.0;
  -
  - let mut t = (0.0, 0.0, 0.0, 0.0);
  -
  for i in left..right {
  let w = (filter.kernel)((i as f32 - inputy) / sratio);
  + ws.push(w);
  sum += w;
  + }
  +
  + for x in 0..width {
  + let mut t = (0.0, 0.0, 0.0, 0.0);
  - let p = image.get_pixel(x, i);
  + for (i, w) in ws.iter().enumerate() {
  + let p = image.get_pixel(x, left + i as u32);
  let (k1, k2, k3, k4) = p.channels4();
  let vec: (f32, f32, f32, f32) = (
  