Skip to content
Permalink
Browse files

Formmating

  • Loading branch information...
maharsh312 authored and jdm committed May 16, 2019
1 parent e3707ec commit c658c07fb1bf1b92c3d1d0d04d6c814fd22538b6
@@ -245,11 +245,7 @@ impl CanvasState {
}
}

fn parse_color(
&self,
canvas: Option<&HTMLCanvasElement>,
string: &str,
) -> Result<RGBA, ()> {
fn parse_color(&self, canvas: Option<&HTMLCanvasElement>, string: &str) -> Result<RGBA, ()> {
let mut input = ParserInput::new(string);
let mut parser = Parser::new(&mut input);
let color = CSSColor::parse(&mut parser);
@@ -1523,7 +1519,9 @@ impl CanvasRenderingContext2D {
}

pub fn get_rect(&self, rect: Rect<u32>) -> Vec<u8> {
self.canvas_state.borrow().get_rect(self.canvas.as_ref().map(|c| &**c), rect)
self.canvas_state
.borrow()
.get_rect(self.canvas.as_ref().map(|c| &**c), rect)
}
}

@@ -1707,9 +1705,14 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
dw: f64,
dh: f64,
) -> ErrorResult {
self.canvas_state
.borrow()
.DrawImage_(self.canvas.as_ref().map(|c| &**c), image, dx, dy, dw, dh)
self.canvas_state.borrow().DrawImage_(
self.canvas.as_ref().map(|c| &**c),
image,
dx,
dy,
dw,
dh,
)
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
@@ -1725,9 +1728,18 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
dw: f64,
dh: f64,
) -> ErrorResult {
self.canvas_state
.borrow()
.DrawImage__(self.canvas.as_ref().map(|c| &**c), image, sx, sy, sw, sh, dx, dy, dw, dh)
self.canvas_state.borrow().DrawImage__(
self.canvas.as_ref().map(|c| &**c),
image,
sx,
sy,
sw,
sh,
dx,
dy,
dw,
dh,
)
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-moveto
@@ -1813,7 +1825,9 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {

// https://html.spec.whatwg.org/multipage/#dom-context-2d-strokestyle
fn SetFillStyle(&self, value: StringOrCanvasGradientOrCanvasPattern) {
self.canvas_state.borrow().SetFillStyle(self.canvas.as_ref().map(|c| &**c), value)
self.canvas_state
.borrow()
.SetFillStyle(self.canvas.as_ref().map(|c| &**c), value)
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-createimagedata
@@ -1832,16 +1846,24 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {

// https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata
fn GetImageData(&self, sx: i32, sy: i32, sw: i32, sh: i32) -> Fallible<DomRoot<ImageData>> {
self.canvas_state
.borrow()
.GetImageData(self.canvas.as_ref().map(|c| &**c), &self.global(), sx, sy, sw, sh)
self.canvas_state.borrow().GetImageData(
self.canvas.as_ref().map(|c| &**c),
&self.global(),
sx,
sy,
sw,
sh,
)
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
fn PutImageData(&self, imagedata: &ImageData, dx: i32, dy: i32) {
self.canvas_state
.borrow()
.PutImageData(self.canvas.as_ref().map(|c| &**c), imagedata, dx, dy)
self.canvas_state.borrow().PutImageData(
self.canvas.as_ref().map(|c| &**c),
imagedata,
dx,
dy,
)
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
@@ -93,8 +93,12 @@ impl OffscreenCanvas {
};
}
let size = self.get_size();
let context =
OffscreenCanvasRenderingContext2D::new(&self.global(), self, size, self.placeholder.as_ref().map(|c| &**c));
let context = OffscreenCanvasRenderingContext2D::new(
&self.global(),
self,
size,
self.placeholder.as_ref().map(|c| &**c),
);
*self.context.borrow_mut() = Some(OffscreenCanvasContext::OffscreenContext2d(
Dom::from_ref(&*context),
));
@@ -304,16 +304,24 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex

// https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata
fn GetImageData(&self, sx: i32, sy: i32, sw: i32, sh: i32) -> Fallible<DomRoot<ImageData>> {
self.canvas_state
.borrow()
.GetImageData(self.htmlcanvas.as_ref().map(|c| &**c), &self.global(), sx, sy, sw, sh)
self.canvas_state.borrow().GetImageData(
self.htmlcanvas.as_ref().map(|c| &**c),
&self.global(),
sx,
sy,
sw,
sh,
)
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
fn PutImageData(&self, imagedata: &ImageData, dx: i32, dy: i32) {
self.canvas_state
.borrow()
.PutImageData(self.htmlcanvas.as_ref().map(|c| &**c), imagedata, dx, dy)
self.canvas_state.borrow().PutImageData(
self.htmlcanvas.as_ref().map(|c| &**c),
imagedata,
dx,
dy,
)
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
@@ -356,9 +364,14 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
dw: f64,
dh: f64,
) -> ErrorResult {
self.canvas_state
.borrow()
.DrawImage_(self.htmlcanvas.as_ref().map(|c| &**c), image, dx, dy, dw, dh)
self.canvas_state.borrow().DrawImage_(
self.htmlcanvas.as_ref().map(|c| &**c),
image,
dx,
dy,
dw,
dh,
)
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage

0 comments on commit c658c07

Please sign in to comment.
You can’t perform that action at this time.