diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-10-06 10:53:10 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-10-06 10:53:10 +0200 |
commit | f13e35b2c55f6ee044373ef26874230800f11c00 (patch) | |
tree | ed9e10b04e56b8f411d7cb1565a3f149c3b81488 /components/canvas/canvas_data.rs | |
parent | 75e6f5dfaabd8ff01916b929edaceedf47fe6309 (diff) | |
download | servo-f13e35b2c55f6ee044373ef26874230800f11c00.tar.gz servo-f13e35b2c55f6ee044373ef26874230800f11c00.zip |
Always make sure we get a surface in CanvasData::put_image_data
Diffstat (limited to 'components/canvas/canvas_data.rs')
-rw-r--r-- | components/canvas/canvas_data.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index 30e6218d604..7ccd7b6184e 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -458,17 +458,17 @@ impl<'a> CanvasData<'a> { ) { assert_eq!(imagedata_size.area() * 4, imagedata.len() as i32); pixels::byte_swap_and_premultiply_inplace(&mut imagedata); - if let Some(source_surface) = self.drawtarget.create_source_surface_from_data( - &imagedata, - imagedata_size, - imagedata_size.width * 4, - SurfaceFormat::B8G8R8A8) { - self.drawtarget.copy_surface( - source_surface, - Rect::from_size(imagedata_size), - offset.to_point(), - ); - } + let source_surface = self.drawtarget.create_source_surface_from_data( + &imagedata, + imagedata_size, + imagedata_size.width * 4, + SurfaceFormat::B8G8R8A8, + ).unwrap(); + self.drawtarget.copy_surface( + source_surface, + Rect::from_size(imagedata_size), + offset.to_point(), + ); } pub fn set_shadow_offset_x(&mut self, value: f64) { |