mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Store a reference to the WebGLRenderingContext in WebGLObject
This commit is contained in:
parent
8933a06eb8
commit
661e258b28
10 changed files with 231 additions and 233 deletions
|
@ -4,17 +4,25 @@
|
|||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
|
||||
use dom::bindings::reflector::Reflector;
|
||||
use dom::bindings::root::Dom;
|
||||
use dom::webglrenderingcontext::WebGLRenderingContext;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct WebGLObject {
|
||||
reflector_: Reflector,
|
||||
context: Dom<WebGLRenderingContext>,
|
||||
}
|
||||
|
||||
impl WebGLObject {
|
||||
pub fn new_inherited() -> WebGLObject {
|
||||
pub fn new_inherited(context: &WebGLRenderingContext) -> WebGLObject {
|
||||
WebGLObject {
|
||||
reflector_: Reflector::new(),
|
||||
context: Dom::from_ref(context),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn context(&self) -> &WebGLRenderingContext {
|
||||
&self.context
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue