script/dom/webgl/extensions/ext/
extblendminmax.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use canvas_traits::webgl::WebGLVersion;
6use dom_struct::dom_struct;
7
8use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
9use crate::dom::bindings::reflector::{DomGlobal, Reflector, reflect_dom_object};
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::webgl::webglrenderingcontext::WebGLRenderingContext;
12use crate::script_runtime::CanGc;
13
14#[dom_struct]
15pub(crate) struct EXTBlendMinmax {
16    reflector_: Reflector,
17}
18
19impl EXTBlendMinmax {
20    fn new_inherited() -> Self {
21        Self {
22            reflector_: Reflector::new(),
23        }
24    }
25}
26
27impl WebGLExtension for EXTBlendMinmax {
28    type Extension = Self;
29
30    fn new(ctx: &WebGLRenderingContext, can_gc: CanGc) -> DomRoot<Self> {
31        reflect_dom_object(Box::new(Self::new_inherited()), &*ctx.global(), can_gc)
32    }
33
34    fn spec() -> WebGLExtensionSpec {
35        WebGLExtensionSpec::Specific(WebGLVersion::WebGL1)
36    }
37
38    fn is_supported(ext: &WebGLExtensions) -> bool {
39        ext.supports_gl_extension("GL_EXT_blend_minmax")
40    }
41
42    fn enable(ext: &WebGLExtensions) {
43        ext.enable_blend_minmax();
44    }
45
46    fn name() -> &'static str {
47        "EXT_blend_minmax"
48    }
49}