diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-07-24 13:27:33 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-07-24 13:27:33 +0200 |
commit | 661e258b28fd7dcc92ab233f66bf49c061542865 (patch) | |
tree | 602fefb45a030dabfafc4d648cf7b214be657eac /components/script/dom/webglvertexarrayobjectoes.rs | |
parent | 8933a06eb8cf0815927c7491dd572c5c776f6d14 (diff) | |
download | servo-661e258b28fd7dcc92ab233f66bf49c061542865.tar.gz servo-661e258b28fd7dcc92ab233f66bf49c061542865.zip |
Store a reference to the WebGLRenderingContext in WebGLObject
Diffstat (limited to 'components/script/dom/webglvertexarrayobjectoes.rs')
-rw-r--r-- | components/script/dom/webglvertexarrayobjectoes.rs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/components/script/dom/webglvertexarrayobjectoes.rs b/components/script/dom/webglvertexarrayobjectoes.rs index 883559f8ac2..029cb30bea5 100644 --- a/components/script/dom/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webglvertexarrayobjectoes.rs @@ -4,12 +4,11 @@ use canvas_traits::webgl::WebGLVertexArrayId; use dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding; -use dom::bindings::reflector::reflect_dom_object; +use dom::bindings::reflector::{DomObject, reflect_dom_object}; use dom::bindings::root::{DomRoot, MutNullableDom}; -use dom::globalscope::GlobalScope; use dom::webglbuffer::WebGLBuffer; use dom::webglobject::WebGLObject; -use dom::webglrenderingcontext::VertexAttribs; +use dom::webglrenderingcontext::{VertexAttribs, WebGLRenderingContext}; use dom_struct::dom_struct; use std::cell::Cell; @@ -24,25 +23,21 @@ pub struct WebGLVertexArrayObjectOES { } impl WebGLVertexArrayObjectOES { - fn new_inherited(id: WebGLVertexArrayId, max_vertex_attribs: u32) -> Self { + fn new_inherited(context: &WebGLRenderingContext, id: WebGLVertexArrayId) -> Self { Self { - webgl_object_: WebGLObject::new_inherited(), + webgl_object_: WebGLObject::new_inherited(context), id: id, ever_bound: Cell::new(false), is_deleted: Cell::new(false), - vertex_attribs: VertexAttribs::new(max_vertex_attribs), + vertex_attribs: VertexAttribs::new(context.limits().max_vertex_attribs), bound_buffer_element_array: MutNullableDom::new(None), } } - pub fn new( - global: &GlobalScope, - id: WebGLVertexArrayId, - max_vertex_attribs: u32, - ) -> DomRoot<Self> { + pub fn new(context: &WebGLRenderingContext, id: WebGLVertexArrayId) -> DomRoot<Self> { reflect_dom_object( - Box::new(WebGLVertexArrayObjectOES::new_inherited(id, max_vertex_attribs)), - global, + Box::new(WebGLVertexArrayObjectOES::new_inherited(context, id)), + &*context.global(), WebGLVertexArrayObjectOESBinding::Wrap, ) } |