Fix isize usage in module gfx

This commit is contained in:
Cobrand
2016-12-06 16:45:24 +01:00
parent fad2b6e52b
commit ffcbd90ccb
3 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -420,7 +420,7 @@ pub fn clip_to_range(src1: CVec<u8>, tmin: u8, tmax: u8) -> Result<CVec<u8>, Str
}
/// Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin).
pub fn normalize_linear(src1: CVec<u8>, cmin: isize, cmax: isize, nmin: isize, nmax: isize) -> Result<CVec<u8>, String> {
pub fn normalize_linear(src1: CVec<u8>, cmin: i32, cmax: i32, nmin: i32, nmax: i32) -> Result<CVec<u8>, String> {
let size = src1.len();
let dest = cvec_with_size(size);
let ret = unsafe { ll::SDL_imageFilterNormalizeLinear(mem::transmute(src1.get(0)),
+2 -2
View File
@@ -267,7 +267,7 @@ pub trait DrawRenderer {
fn aa_polygon<C: ToColor>(&self, vx: &[i16], vy: &[i16], color: C) -> Result<(), String>;
fn filled_polygon<C: ToColor>(&self, vx: &[i16], vy: &[i16], color: C) -> Result<(), String>;
fn textured_polygon<C: ToColor>(&self, vx: &[i16], vy: &[i16], texture: &Surface, texture_dx: i16, texture_dy: i16, color: C) -> Result<(), String>;
fn bezier<C: ToColor>(&self, vx: &[i16], vy: &[i16], s: isize, color: C) -> Result<(), String>;
fn bezier<C: ToColor>(&self, vx: &[i16], vy: &[i16], s: i32, color: C) -> Result<(), String>;
fn character<C: ToColor>(&self, x: i16, y: i16, c: char, color: C) -> Result<(), String>;
fn string<C: ToColor>(&self, x: i16, y: i16, s: &str, color: C) -> Result<(), String>;
}
@@ -462,7 +462,7 @@ impl<'a> DrawRenderer for Renderer<'a> {
unimplemented!()
}
fn bezier<C: ToColor>(&self, vx: &[i16], vy: &[i16], s: isize, color: C) -> Result<(), String> {
fn bezier<C: ToColor>(&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 {
+10 -10
View File
@@ -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<Surface, String>;
/// Shrink a surface by an integer ratio using averaging.
fn shrink(&self, factorx: isize, factory: isize) -> Result<Surface, String>;
fn shrink(&self, factorx: i32, factory: i32) -> Result<Surface, String>;
/// Rotates a 8/16/24/32 bit surface in increments of 90 degrees.
fn rotate_90deg(&self, turns: isize) -> Result<Surface, String>;
fn rotate_90deg(&self, turns: i32) -> Result<Surface, String>;
}
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<Surface, String> {
fn shrink(&self, factorx: i32, factory: i32) -> Result<Surface, String> {
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<Surface, String> {
fn rotate_90deg(&self, turns: i32) -> Result<Surface, String> {
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)
}