Skip to content

Commit

Permalink
Always make sure we get a surface in CanvasData::put_image_data
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Oct 6, 2018
1 parent 75e6f5d commit f13e35b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions components/canvas/canvas_data.rs
Expand Up @@ -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) {
Expand Down

0 comments on commit f13e35b

Please sign in to comment.