aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlcanvaselement.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-08-25 09:23:00 -0600
committerbors-servo <metajack+bors@gmail.com>2015-08-25 09:23:00 -0600
commita109a333f1f95d4fc677b29e3613b2615514c080 (patch)
tree3509f4dc996823641e384972baf7a22aa5ad1ad9 /components/script/dom/htmlcanvaselement.rs
parent4d0b4a7b8cda681d1cd6b6cd8e690c0793532d0b (diff)
parent6341c77700fa5f914c32c6153e9c532bc69474fd (diff)
downloadservo-a109a333f1f95d4fc677b29e3613b2615514c080.tar.gz
servo-a109a333f1f95d4fc677b29e3613b2615514c080.zip
Auto merge of #6770 - ecoal95:webgl-again, r=jdm
Add multiple WebGL calls and improve error detection Since it probably won't merge until multiprocess lands, I plan to use this PR to keep improving WebGL support until it can land. Main TODOs are integration of tests, since it seems https://github.com/KhronosGroup/WebGL/issues/1105 is going nowhere, adding missing calls and proper painting via native surfaces instead of readback. I can't resolve conflicts right now because of time but I will do it soon. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6770) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/htmlcanvaselement.rs')
-rw-r--r--components/script/dom/htmlcanvaselement.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index 4823f881be7..83e8397d859 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -159,6 +159,7 @@ pub trait HTMLCanvasElementHelpers {
fn get_or_init_webgl_context(self,
cx: *mut JSContext,
attrs: Option<HandleValue>) -> Option<Root<WebGLRenderingContext>>;
+
fn is_valid(self) -> bool;
}
@@ -325,3 +326,18 @@ impl<'a> From<&'a WebGLContextAttributes> for GLContextAttributes {
}
}
+pub mod utils {
+ use dom::window::Window;
+ use ipc_channel::ipc;
+ use net_traits::image_cache_task::{ImageCacheChan, ImageResponse};
+ use url::Url;
+
+ pub fn request_image_from_cache(window: &Window, url: Url) -> ImageResponse {
+ let image_cache = window.image_cache_task();
+ let (response_chan, response_port) = ipc::channel().unwrap();
+ image_cache.request_image(url, ImageCacheChan(response_chan), None);
+ let result = response_port.recv().unwrap();
+ result.image_response
+ }
+}
+