diff options
Diffstat (limited to 'components/script/dom/webgltexture.rs')
-rw-r--r-- | components/script/dom/webgltexture.rs | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index 4d085d51442..4d8e58380f7 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -12,9 +12,8 @@ use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderi use dom::bindings::codegen::Bindings::WebGLTextureBinding; use dom::bindings::inheritance::Castable; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, DomRoot}; +use dom::bindings::root::DomRoot; use dom::webgl_validations::types::{TexImageTarget, TexFormat, TexDataType}; -use dom::webglframebuffer::WebGLFramebuffer; use dom::webglobject::WebGLObject; use dom::webglrenderingcontext::WebGLRenderingContext; use dom_struct::dom_struct; @@ -49,8 +48,6 @@ pub struct WebGLTexture { mag_filter: Cell<u32>, /// True if this texture is used for the DOMToTexture feature. attached_to_dom: Cell<bool>, - // Framebuffer that this texture is attached to. - attached_framebuffers: DomRefCell<Vec<Dom<WebGLFramebuffer>>>, } impl WebGLTexture { @@ -66,7 +63,6 @@ impl WebGLTexture { mag_filter: Cell::new(constants::LINEAR), image_info_array: DomRefCell::new([ImageInfo::new(); MAX_LEVEL_COUNT * MAX_FACE_COUNT]), attached_to_dom: Cell::new(false), - attached_framebuffers: Default::default(), } } @@ -201,16 +197,9 @@ impl WebGLTexture { let currently_bound_framebuffer = self.upcast::<WebGLObject>() .context() - .bound_framebuffer() - .map_or(0, |fb| fb.id().get()); - let current_framebuffer = - self.attached_framebuffers - .borrow() - .iter() - .position(|fb| fb.id().get() == currently_bound_framebuffer); - if let Some(fb_index) = current_framebuffer { - self.attached_framebuffers.borrow()[fb_index].detach_texture(self); - self.attached_framebuffers.borrow_mut().remove(fb_index); + .bound_framebuffer(); + if let Some(fb) = currently_bound_framebuffer { + fb.detach_texture(self); } context.send_command(WebGLCommand::DeleteTexture(self.id)); @@ -425,20 +414,6 @@ impl WebGLTexture { pub fn set_attached_to_dom(&self) { self.attached_to_dom.set(true); } - - pub fn attach(&self, framebuffer: &WebGLFramebuffer) { - self.attached_framebuffers.borrow_mut().push(Dom::from_ref(framebuffer)); - } - - pub fn unattach(&self, fb: &WebGLFramebuffer) { - let mut attached_framebuffers = self.attached_framebuffers.borrow_mut(); - let idx = attached_framebuffers.iter().position(|attached| { - attached.id() == fb.id() - }); - if let Some(idx) = idx { - attached_framebuffers.remove(idx); - } - } } impl Drop for WebGLTexture { |