Don't create 2D canvas contexts arbitrarily

Sometimes, the canvas still has no rendering context, in this case it represents
a transparent black rectangle.
This commit is contained in:
Anthony Ramine 2018-09-15 12:28:53 +02:00
parent ed673f8070
commit f1e8eb640c
4 changed files with 107 additions and 90 deletions

View file

@ -38,7 +38,7 @@ pub struct CanvasImageData {
pub enum Canvas2dMsg {
Arc(Point2D<f32>, f32, f32, f32, bool),
ArcTo(Point2D<f32>, Point2D<f32>, f32),
DrawImage(ByteBuf, Size2D<f64>, Rect<f64>, Rect<f64>, bool),
DrawImage(Option<ByteBuf>, Size2D<f64>, Rect<f64>, Rect<f64>, bool),
DrawImageSelf(Size2D<f64>, Rect<f64>, Rect<f64>, bool),
DrawImageInOther(
CanvasId, Size2D<f64>, Rect<f64>, Rect<f64>, bool),