From ffcbd90ccbafb4de149c0097c3f59fe4181f644c Mon Sep 17 00:00:00 2001 From: Cobrand Date: Tue, 6 Dec 2016 16:36:46 +0100 Subject: [PATCH] Fix isize usage in module gfx --- src/sdl2/gfx/imagefilter.rs | 2 +- src/sdl2/gfx/primitives.rs | 4 ++-- src/sdl2/gfx/rotozoom.rs | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sdl2/gfx/imagefilter.rs b/src/sdl2/gfx/imagefilter.rs index f59be425..2c979626 100644 --- a/src/sdl2/gfx/imagefilter.rs +++ b/src/sdl2/gfx/imagefilter.rs @@ -420,7 +420,7 @@ pub fn clip_to_range(src1: CVec, tmin: u8, tmax: u8) -> Result, Str } /// Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin). -pub fn normalize_linear(src1: CVec, cmin: isize, cmax: isize, nmin: isize, nmax: isize) -> Result, String> { +pub fn normalize_linear(src1: CVec, cmin: i32, cmax: i32, nmin: i32, nmax: i32) -> Result, String> { let size = src1.len(); let dest = cvec_with_size(size); let ret = unsafe { ll::SDL_imageFilterNormalizeLinear(mem::transmute(src1.get(0)), diff --git a/src/sdl2/gfx/primitives.rs b/src/sdl2/gfx/primitives.rs index e0b02b69..39d2bca1 100644 --- a/src/sdl2/gfx/primitives.rs +++ b/src/sdl2/gfx/primitives.rs @@ -267,7 +267,7 @@ pub trait DrawRenderer { fn aa_polygon(&self, vx: &[i16], vy: &[i16], color: C) -> Result<(), String>; fn filled_polygon(&self, vx: &[i16], vy: &[i16], color: C) -> Result<(), String>; fn textured_polygon(&self, vx: &[i16], vy: &[i16], texture: &Surface, texture_dx: i16, texture_dy: i16, color: C) -> Result<(), String>; - fn bezier(&self, vx: &[i16], vy: &[i16], s: isize, color: C) -> Result<(), String>; + fn bezier(&self, vx: &[i16], vy: &[i16], s: i32, color: C) -> Result<(), String>; fn character(&self, x: i16, y: i16, c: char, color: C) -> Result<(), String>; fn string(&self, x: i16, y: i16, s: &str, color: C) -> Result<(), String>; } @@ -462,7 +462,7 @@ impl<'a> DrawRenderer for Renderer<'a> { unimplemented!() } - fn bezier(&self, vx: &[i16], vy: &[i16], s: isize, color: C) -> Result<(), String> { + fn bezier(&self, vx: &[i16], vy: &[i16], s: i32, color: C) -> Result<(), String> { assert_eq!(vx.len(), vy.len()); let n = vx.len() as c_int; let ret = unsafe { diff --git a/src/sdl2/gfx/rotozoom.rs b/src/sdl2/gfx/rotozoom.rs index d6f40096..4845ac6a 100644 --- a/src/sdl2/gfx/rotozoom.rs +++ b/src/sdl2/gfx/rotozoom.rs @@ -46,9 +46,9 @@ pub trait RotozoomSurface { /// Zoom a surface by independent horizontal and vertical factors with optional smoothing. fn zoom(&self, zoomx: f64, zoomy: f64, smooth: bool) -> Result; /// Shrink a surface by an integer ratio using averaging. - fn shrink(&self, factorx: isize, factory: isize) -> Result; + fn shrink(&self, factorx: i32, factory: i32) -> Result; /// Rotates a 8/16/24/32 bit surface in increments of 90 degrees. - fn rotate_90deg(&self, turns: isize) -> Result; + fn rotate_90deg(&self, turns: i32) -> Result; } impl<'a> RotozoomSurface for Surface<'a> { @@ -82,7 +82,7 @@ impl<'a> RotozoomSurface for Surface<'a> { unsafe { Ok(Surface::from_ll(raw)) } } } - fn shrink(&self, factorx: isize, factory: isize) -> Result { + fn shrink(&self, factorx: i32, factory: i32) -> Result { let raw = unsafe { ll::shrinkSurface(self.raw(), factorx as c_int, factory as c_int) }; @@ -92,7 +92,7 @@ impl<'a> RotozoomSurface for Surface<'a> { unsafe { Ok(Surface::from_ll(raw)) } } } - fn rotate_90deg(&self, turns: isize) -> Result { + fn rotate_90deg(&self, turns: i32) -> Result { let raw = unsafe { ll::rotateSurface90Degrees(self.raw(), turns as c_int) }; @@ -104,23 +104,23 @@ impl<'a> RotozoomSurface for Surface<'a> { } } -pub fn get_zoom_size(width: isize, height: isize, zoomx: f64, zoomy: f64) -> (isize, isize) { +pub fn get_zoom_size(width: i32, height: i32, zoomx: f64, zoomy: f64) -> (i32, i32) { let mut w: c_int = 0; let mut h: c_int = 0; unsafe { ll::zoomSurfaceSize(width as c_int, height as c_int, zoomx, zoomy, &mut w, &mut h) } - (w as isize, h as isize) + (w as i32, h as i32) } -pub fn get_rotozoom_size(width: isize, height: isize, angle: f64, zoom: f64) -> (isize, isize) { +pub fn get_rotozoom_size(width: i32, height: i32, angle: f64, zoom: f64) -> (i32, i32) { let mut w: c_int = 0; let mut h: c_int = 0; unsafe { ll::rotozoomSurfaceSize(width as c_int, height as c_int, angle, zoom, &mut w, &mut h) } - (w as isize, h as isize) + (w as i32, h as i32) } -pub fn get_rotozoom_xy_size(width: isize, height: isize, angle: f64, zoomx: f64, zoomy: f64) -> (isize, isize) { +pub fn get_rotozoom_xy_size(width: i32, height: i32, angle: f64, zoomx: f64, zoomy: f64) -> (i32, i32) { let mut w: c_int = 0; let mut h: c_int = 0; unsafe { ll::rotozoomSurfaceSizeXY(width as c_int, height as c_int, angle, zoomx, zoomy, &mut w, &mut h) } - (w as isize, h as isize) + (w as i32, h as i32) }