mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Share some code between 2D canvas and WebGL
This commit is contained in:
parent
05ef233097
commit
6c469b90b1
6 changed files with 58 additions and 84 deletions
|
@ -368,13 +368,13 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
|||
context.get_rect(Rect::from_size(self.get_size()))
|
||||
},
|
||||
Some(CanvasContext::WebGL(ref context)) => {
|
||||
match context.get_image_data(self.Width(), self.Height()) {
|
||||
match context.get_image_data(self.get_size()) {
|
||||
Some(data) => data,
|
||||
None => return Ok(USVString("data:,".into())),
|
||||
}
|
||||
},
|
||||
Some(CanvasContext::WebGL2(ref context)) => {
|
||||
match context.base_context().get_image_data(self.Width(), self.Height()) {
|
||||
match context.base_context().get_image_data(self.get_size()) {
|
||||
Some(data) => data,
|
||||
None => return Ok(USVString("data:,".into())),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue