diff options
Diffstat (limited to 'components/script/dom/webglvertexarrayobjectoes.rs')
-rw-r--r-- | components/script/dom/webglvertexarrayobjectoes.rs | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/components/script/dom/webglvertexarrayobjectoes.rs b/components/script/dom/webglvertexarrayobjectoes.rs index 4ca8c7b7add..49babf3095d 100644 --- a/components/script/dom/webglvertexarrayobjectoes.rs +++ b/components/script/dom/webglvertexarrayobjectoes.rs @@ -3,17 +3,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use canvas_traits::webgl::WebGLVertexArrayId; -use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::WebGLVertexArrayObjectOESBinding; use dom::bindings::reflector::reflect_dom_object; -use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; +use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::globalscope::GlobalScope; use dom::webglbuffer::WebGLBuffer; use dom::webglobject::WebGLObject; +use dom::webglrenderingcontext::BoundAttribBuffers; use dom_struct::dom_struct; -use std::cell::{Cell, Ref}; -use std::collections::HashMap; -use std::iter::FromIterator; +use std::cell::Cell; #[dom_struct] pub struct WebGLVertexArrayObjectOES { @@ -21,7 +19,7 @@ pub struct WebGLVertexArrayObjectOES { id: WebGLVertexArrayId, ever_bound: Cell<bool>, is_deleted: Cell<bool>, - bound_attrib_buffers: DomRefCell<HashMap<u32, Dom<WebGLBuffer>>>, + bound_attrib_buffers: BoundAttribBuffers, bound_buffer_element_array: MutNullableDom<WebGLBuffer>, } @@ -32,7 +30,7 @@ impl WebGLVertexArrayObjectOES { id: id, ever_bound: Cell::new(false), is_deleted: Cell::new(false), - bound_attrib_buffers: DomRefCell::new(HashMap::new()), + bound_attrib_buffers: Default::default(), bound_buffer_element_array: MutNullableDom::new(None), } } @@ -43,6 +41,10 @@ impl WebGLVertexArrayObjectOES { WebGLVertexArrayObjectOESBinding::Wrap) } + pub fn bound_attrib_buffers(&self) -> &BoundAttribBuffers { + &self.bound_attrib_buffers + } + pub fn id(&self) -> WebGLVertexArrayId { self.id } @@ -63,18 +65,6 @@ impl WebGLVertexArrayObjectOES { self.ever_bound.set(true); } - pub fn borrow_bound_attrib_buffers(&self) -> Ref<HashMap<u32, Dom<WebGLBuffer>>> { - self.bound_attrib_buffers.borrow() - } - - pub fn bound_attrib_buffers(&self) -> Vec<DomRoot<WebGLBuffer>> { - self.bound_attrib_buffers.borrow().iter().map(|(_, b)| DomRoot::from_ref(&**b)).collect() - } - - pub fn set_bound_attrib_buffers<'a, T>(&self, iter: T) where T: Iterator<Item=(u32, &'a WebGLBuffer)> { - *self.bound_attrib_buffers.borrow_mut() = HashMap::from_iter(iter.map(|(k,v)| (k, Dom::from_ref(v)))); - } - pub fn bound_buffer_element_array(&self) -> Option<DomRoot<WebGLBuffer>> { self.bound_buffer_element_array.get() } |