aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/paint_context.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/gfx/paint_context.rs')
-rw-r--r--components/gfx/paint_context.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs
index d73d9013a05..039ffa15918 100644
--- a/components/gfx/paint_context.rs
+++ b/components/gfx/paint_context.rs
@@ -196,10 +196,14 @@ impl<'a> PaintContext<'a> {
self.draw_target.make_current();
let draw_target_ref = &self.draw_target;
- let azure_surface = draw_target_ref.create_source_surface_from_data(&image.bytes,
- size,
- stride as i32,
- source_format);
+ let azure_surface = match draw_target_ref.create_source_surface_from_data(&image.bytes,
+ size,
+ stride as i32,
+ source_format) {
+ Some(azure_surface) => azure_surface,
+ None => return,
+ };
+
let source_rect = Rect::new(Point2D::new(0.0, 0.0),
Size2D::new(image.width as AzFloat, image.height as AzFloat));
let dest_rect = bounds.to_nearest_azure_rect(scale);