mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
LibAccelGfx: Premultiply linear gradient colors by alpha
With this change color blending for gradients matches CPU painter.
This commit is contained in:
parent
be8952b89d
commit
707added91
3 changed files with 37 additions and 16 deletions
|
@ -23,10 +23,23 @@ void set_viewport(Gfx::IntRect rect)
|
|||
verify_no_error();
|
||||
}
|
||||
|
||||
void enable_blending()
|
||||
static GLenum to_gl_enum(BlendFactor factor)
|
||||
{
|
||||
switch (factor) {
|
||||
case BlendFactor::SrcAlpha:
|
||||
return GL_SRC_ALPHA;
|
||||
case BlendFactor::One:
|
||||
return GL_ONE;
|
||||
case BlendFactor::OneMinusSrcAlpha:
|
||||
return GL_ONE_MINUS_SRC_ALPHA;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void enable_blending(BlendFactor source, BlendFactor destination)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendFunc(to_gl_enum(source), to_gl_enum(destination));
|
||||
verify_no_error();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue