mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Simplify WebGLRenderingContext::PixelStorei
This commit is contained in:
parent
26745b2741
commit
452d85005a
1 changed files with 8 additions and 25 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue