diff options
author | Bailey Blankenship <bblanke@ncsu.edu> | 2019-10-16 18:18:27 -0400 |
---|---|---|
committer | Bailey Blankenship <bblanke@ncsu.edu> | 2019-11-10 18:37:14 -0500 |
commit | ec2961920b74fbe0345f72e6007c6d42ae852019 (patch) | |
tree | fc229640c23741ea304fcd362a8158eab16693a0 /components/pixels/lib.rs | |
parent | f7fb130a2a21ae19cf0996251134ad23fea9068d (diff) | |
download | servo-ec2961920b74fbe0345f72e6007c6d42ae852019.tar.gz servo-ec2961920b74fbe0345f72e6007c6d42ae852019.zip |
Addresses issues raised in #24465; removes redundancy in set_bitmap_dimensions
Removed passing test .ini files and moved euclid extensions to euclidext.rs to factor out redundant code
Diffstat (limited to 'components/pixels/lib.rs')
-rw-r--r-- | components/pixels/lib.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/components/pixels/lib.rs b/components/pixels/lib.rs index 68b22abb11d..88d845a3033 100644 --- a/components/pixels/lib.rs +++ b/components/pixels/lib.rs @@ -23,7 +23,7 @@ pub enum PixelFormat { BGRA8, } -pub fn rgba8_get_rect(pixels: &[u8], size: Size2D<u32>, rect: Rect<u32>) -> Cow<[u8]> { +pub fn rgba8_get_rect(pixels: &[u8], size: Size2D<u64>, rect: Rect<u64>) -> Cow<[u8]> { assert!(!rect.is_empty()); assert!(Rect::from_size(size).contains_rect(&rect)); assert_eq!(pixels.len() % 4, 0); @@ -85,18 +85,19 @@ pub fn multiply_u8_color(a: u8, b: u8) -> u8 { pub fn clip( mut origin: Point2D<i32>, - mut size: Size2D<u32>, - surface: Size2D<u32>, -) -> Option<Rect<u32>> { + mut size: Size2D<u64>, + surface: Size2D<u64>, +) -> Option<Rect<u64>> { if origin.x < 0 { - size.width = size.width.saturating_sub(-origin.x as u32); + size.width = size.width.saturating_sub(-origin.x as u64); origin.x = 0; } if origin.y < 0 { - size.height = size.height.saturating_sub(-origin.y as u32); + size.height = size.height.saturating_sub(-origin.y as u64); origin.y = 0; } - Rect::new(origin.to_u32(), size) + let origin = Point2D::new(origin.x as u64, origin.y as u64); + Rect::new(origin, size) .intersection(&Rect::from_size(surface)) .filter(|rect| !rect.is_empty()) } |