aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlcanvaselement.rs
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2016-02-18 07:57:31 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2016-02-18 10:35:29 +1000
commitc0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f (patch)
treeced94496eb3f3b4149f1c2d3b0b02422bb3b5471 /components/script/dom/htmlcanvaselement.rs
parentf7f0eea47035f4316d09db26315bf8ebb72637c9 (diff)
downloadservo-c0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f.tar.gz
servo-c0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f.zip
Add WebRender integration to Servo.
WebRender is an experimental GPU accelerated rendering backend for Servo. The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used). WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!
Diffstat (limited to 'components/script/dom/htmlcanvaselement.rs')
-rw-r--r--components/script/dom/htmlcanvaselement.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index 3ab122d2bf7..0288efc206a 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use canvas_traits::{CanvasMsg, FromLayoutMsg};
+use canvas_traits::{CanvasMsg, FromLayoutMsg, CanvasData};
use dom::attr::Attr;
use dom::attr::AttrValue;
use dom::bindings::cell::DOMRefCell;
@@ -202,10 +202,17 @@ impl HTMLCanvasElement {
let data = if let Some(renderer) = self.ipc_renderer() {
let (sender, receiver) = ipc::channel().unwrap();
- let msg = CanvasMsg::FromLayout(FromLayoutMsg::SendPixelContents(sender));
+ let msg = CanvasMsg::FromLayout(FromLayoutMsg::SendData(sender));
renderer.send(msg).unwrap();
- receiver.recv().unwrap().to_vec()
+ match receiver.recv().unwrap() {
+ CanvasData::Pixels(pixel_data)
+ => pixel_data.image_data.to_vec(),
+ CanvasData::WebGL(_)
+ // TODO(ecoal95): Not sure if WebGL canvas is required for 2d spec,
+ // but I think it's not.
+ => return None,
+ }
} else {
repeat(0xffu8).take((size.height as usize) * (size.width as usize) * 4).collect()
};