diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-06-22 11:30:10 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-06-22 14:10:56 +0200 |
commit | 02b8766e7533d7318a3588e59bde78f3d639a89b (patch) | |
tree | c1e04726ab05293134290950115c882ef465464d /components/script/dom/webgl_extensions/ext | |
parent | 6a4bd8d3fa8c0c8fe4a85a04fe8405673dbd8513 (diff) | |
download | servo-02b8766e7533d7318a3588e59bde78f3d639a89b.tar.gz servo-02b8766e7533d7318a3588e59bde78f3d639a89b.zip |
Implement EXT_blend_minmax
Diffstat (limited to 'components/script/dom/webgl_extensions/ext')
-rw-r--r-- | components/script/dom/webgl_extensions/ext/extblendminmax.rs | 50 | ||||
-rw-r--r-- | components/script/dom/webgl_extensions/ext/mod.rs | 1 |
2 files changed, 51 insertions, 0 deletions
diff --git a/components/script/dom/webgl_extensions/ext/extblendminmax.rs b/components/script/dom/webgl_extensions/ext/extblendminmax.rs new file mode 100644 index 00000000000..70bf828ccc8 --- /dev/null +++ b/components/script/dom/webgl_extensions/ext/extblendminmax.rs @@ -0,0 +1,50 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use canvas_traits::webgl::WebGLVersion; +use dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding; +use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::DomRoot; +use dom::webglrenderingcontext::WebGLRenderingContext; +use dom_struct::dom_struct; +use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; + +#[dom_struct] +pub struct EXTBlendMinmax { + reflector_: Reflector, +} + +impl EXTBlendMinmax { + fn new_inherited() -> Self { + Self { reflector_: Reflector::new() } + } +} + +impl WebGLExtension for EXTBlendMinmax { + type Extension = Self; + + fn new(ctx: &WebGLRenderingContext) -> DomRoot<Self> { + reflect_dom_object( + Box::new(Self::new_inherited()), + &*ctx.global(), + EXTBlendMinmaxBinding::Wrap, + ) + } + + fn spec() -> WebGLExtensionSpec { + WebGLExtensionSpec::Specific(WebGLVersion::WebGL1) + } + + fn is_supported(ext: &WebGLExtensions) -> bool { + ext.supports_gl_extension("GL_EXT_blend_minmax") + } + + fn enable(ext: &WebGLExtensions) { + ext.enable_blend_minmax(); + } + + fn name() -> &'static str { + "EXT_blend_minmax" + } +} diff --git a/components/script/dom/webgl_extensions/ext/mod.rs b/components/script/dom/webgl_extensions/ext/mod.rs index e0c7b1f189a..bdf19d5327a 100644 --- a/components/script/dom/webgl_extensions/ext/mod.rs +++ b/components/script/dom/webgl_extensions/ext/mod.rs @@ -5,6 +5,7 @@ use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use super::{ext_constants, WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; +pub mod extblendminmax; pub mod extshadertexturelod; pub mod exttexturefilteranisotropic; pub mod oeselementindexuint; |