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
This commit is contained in:
Bailey Blankenship 2019-10-16 18:18:27 -04:00
parent f7fb130a2a
commit ec2961920b
32 changed files with 211 additions and 131 deletions

View file

@ -2963,11 +2963,16 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let src_origin = Point2D::new(x, y);
let src_size = Size2D::new(width as u32, height as u32);
let fb_size = Size2D::new(fb_width as u32, fb_height as u32);
let src_rect = match pixels::clip(src_origin, src_size, fb_size) {
let src_rect = match pixels::clip(src_origin, src_size.to_u64(), fb_size.to_u64()) {
Some(rect) => rect,
None => return,
};
// Note: we're casting a Rect<u64> back into a Rect<u32> here, but it's okay because
// it used u32 data types to begin with. It just got converted to Rect<u64> in
// pixels::clip
let src_rect = src_rect.to_u32();
let mut dest_offset = 0;
if x < 0 {
dest_offset += -x * bytes_per_pixel;
@ -4485,3 +4490,13 @@ impl WebGLMessageSender {
self.wake_after_send(|| self.sender.send_dom_to_texture(command))
}
}
pub trait Size2DExt {
fn to_u64(&self) -> Size2D<u64>;
}
impl Size2DExt for Size2D<u32> {
fn to_u64(&self) -> Size2D<u64> {
return Size2D::new(self.width as u64, self.height as u64);
}
}