diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-09-10 16:24:00 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-09-12 23:45:49 +0200 |
commit | 452d85005a0a7cb972dca0782021eb8d17db9c92 (patch) | |
tree | 97b52980288e91c1f68eaa28a5f5c992fe1afd1f /components/script/dom/webglrenderingcontext.rs | |
parent | 26745b27419f687dec1e23434a5be827d4342768 (diff) | |
download | servo-452d85005a0a7cb972dca0782021eb8d17db9c92.tar.gz servo-452d85005a0a7cb972dca0782021eb8d17db9c92.zip |
Simplify WebGLRenderingContext::PixelStorei
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index ea45fd69ce5..fc1977a2962 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2517,36 +2517,18 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { let mut texture_settings = self.texture_unpacking_settings.get(); match param_name { constants::UNPACK_FLIP_Y_WEBGL => { - if param_value != 0 { - texture_settings.insert(TextureUnpacking::FLIP_Y_AXIS) - } else { - texture_settings.remove(TextureUnpacking::FLIP_Y_AXIS) - } - - self.texture_unpacking_settings.set(texture_settings); - return; + texture_settings.set(TextureUnpacking::FLIP_Y_AXIS, param_value != 0); }, constants::UNPACK_PREMULTIPLY_ALPHA_WEBGL => { - if param_value != 0 { - texture_settings.insert(TextureUnpacking::PREMULTIPLY_ALPHA) - } else { - texture_settings.remove(TextureUnpacking::PREMULTIPLY_ALPHA) - } - - self.texture_unpacking_settings.set(texture_settings); - return; + texture_settings.set(TextureUnpacking::PREMULTIPLY_ALPHA, param_value != 0); }, constants::UNPACK_COLORSPACE_CONVERSION_WEBGL => { - match param_value as u32 { - constants::BROWSER_DEFAULT_WEBGL - => texture_settings.insert(TextureUnpacking::CONVERT_COLORSPACE), - constants::NONE - => texture_settings.remove(TextureUnpacking::CONVERT_COLORSPACE), + let convert = match param_value as u32 { + constants::BROWSER_DEFAULT_WEBGL => true, + constants::NONE => false, _ => return self.webgl_error(InvalidEnum), - } - - self.texture_unpacking_settings.set(texture_settings); - return; + }; + texture_settings.set(TextureUnpacking::CONVERT_COLORSPACE, convert); }, constants::UNPACK_ALIGNMENT | constants::PACK_ALIGNMENT => { @@ -2559,6 +2541,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { }, _ => return self.webgl_error(InvalidEnum), } + self.texture_unpacking_settings.set(texture_settings); } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3 |