mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 10:17:35 +00:00
LibGL: Simplify setting the color mask
This commit is contained in:
parent
8e3b7df408
commit
bac7a12fb9
1 changed files with 4 additions and 23 deletions
|
@ -650,29 +650,10 @@ void GLContext::gl_depth_func(GLenum func)
|
||||||
void GLContext::gl_color_mask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
|
void GLContext::gl_color_mask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
|
||||||
{
|
{
|
||||||
auto options = m_rasterizer->options();
|
auto options = m_rasterizer->options();
|
||||||
auto mask = options.color_mask;
|
options.color_mask = (red == GL_TRUE ? 0xff : 0)
|
||||||
|
| (green == GL_TRUE ? 0xff00 : 0)
|
||||||
if (!red)
|
| (blue == GL_TRUE ? 0xff0000 : 0)
|
||||||
mask &= ~0x000000ff;
|
| (alpha == GL_TRUE ? 0xff000000 : 0);
|
||||||
else
|
|
||||||
mask |= 0x000000ff;
|
|
||||||
|
|
||||||
if (!green)
|
|
||||||
mask &= ~0x0000ff00;
|
|
||||||
else
|
|
||||||
mask |= 0x0000ff00;
|
|
||||||
|
|
||||||
if (!blue)
|
|
||||||
mask &= ~0x00ff0000;
|
|
||||||
else
|
|
||||||
mask |= 0x00ff0000;
|
|
||||||
|
|
||||||
if (!alpha)
|
|
||||||
mask &= ~0xff000000;
|
|
||||||
else
|
|
||||||
mask |= 0xff000000;
|
|
||||||
|
|
||||||
options.color_mask = mask;
|
|
||||||
m_rasterizer->set_options(options);
|
m_rasterizer->set_options(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue