diff options
author | Glenn Watson <gw@intuitionlibrary.com> | 2016-02-18 07:57:31 +1000 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2016-02-18 10:35:29 +1000 |
commit | c0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f (patch) | |
tree | ced94496eb3f3b4149f1c2d3b0b02422bb3b5471 /components/script/dom | |
parent | f7f0eea47035f4316d09db26315bf8ebb72637c9 (diff) | |
download | servo-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')
-rw-r--r-- | components/script/dom/htmlcanvaselement.rs | 13 | ||||
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 2 |
2 files changed, 12 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() }; diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index ff2d6968e9a..aba9e32b45f 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -72,6 +72,7 @@ pub struct WebGLRenderingContext { #[ignore_heap_size_of = "Defined in ipc-channel"] ipc_renderer: IpcSender<CanvasMsg>, canvas: JS<HTMLCanvasElement>, + #[ignore_heap_size_of = "Defined in webrender_traits"] last_error: Cell<Option<WebGLError>>, texture_unpacking_settings: Cell<TextureUnpacking>, bound_texture_2d: MutNullableHeap<JS<WebGLTexture>>, @@ -462,6 +463,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { Some(data) => data, None => return self.webgl_error(InvalidValue), }; + if offset < 0 { return self.webgl_error(InvalidValue); } |