mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +00:00
LibAccelGfx: Set blending for alpha separately to be sum of src and dst
With this change we match blending in LibGfx and it fixes rendering on all websites that use opacity < 1.
This commit is contained in:
parent
c55d8a9971
commit
2361ce25a0
3 changed files with 9 additions and 9 deletions
|
@ -205,7 +205,7 @@ void Painter::fill_rect(Gfx::FloatRect rect, Gfx::Color color)
|
|||
|
||||
GL::set_uniform(color_uniform, red, green, blue, alpha);
|
||||
GL::set_vertex_attribute(position_attribute, 0, 2);
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha);
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha, GL::BlendFactor::One, GL::BlendFactor::One);
|
||||
GL::draw_arrays(GL::DrawPrimitive::TriangleFan, 4);
|
||||
|
||||
GL::delete_buffer(vbo);
|
||||
|
@ -254,7 +254,7 @@ void Painter::fill_rect_with_rounded_corners(Gfx::FloatRect const& rect, Color c
|
|||
auto bottom_right_corner_radius_uniform = m_rounded_rectangle_program.get_uniform_location("uBottomRightRadius");
|
||||
GL::set_uniform(bottom_right_corner_radius_uniform, bottom_right_radius.horizontal_radius, bottom_right_radius.vertical_radius);
|
||||
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha);
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha, GL::BlendFactor::One, GL::BlendFactor::One);
|
||||
GL::draw_arrays(GL::DrawPrimitive::TriangleFan, 4);
|
||||
|
||||
GL::delete_buffer(vbo);
|
||||
|
@ -297,7 +297,7 @@ void Painter::draw_line(Gfx::FloatPoint a, Gfx::FloatPoint b, float thickness, C
|
|||
|
||||
GL::set_uniform(color_uniform, red, green, blue, alpha);
|
||||
GL::set_vertex_attribute(position_attribute, 0, 2);
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha);
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha, GL::BlendFactor::One, GL::BlendFactor::One);
|
||||
GL::draw_arrays(GL::DrawPrimitive::TriangleFan, 4);
|
||||
|
||||
GL::delete_buffer(vbo);
|
||||
|
@ -438,7 +438,7 @@ void Painter::draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Col
|
|||
|
||||
GL::set_uniform(color_uniform, red, green, blue, alpha);
|
||||
GL::set_vertex_attribute(position_attribute, 0, 4);
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha);
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha, GL::BlendFactor::One, GL::BlendFactor::One);
|
||||
GL::draw_arrays(GL::DrawPrimitive::Triangles, vertices.size() / 4);
|
||||
|
||||
GL::delete_buffer(vbo);
|
||||
|
@ -535,7 +535,7 @@ void Painter::fill_rect_with_linear_gradient(Gfx::FloatRect const& rect, Readonl
|
|||
GL::bind_buffer(vbo_colors);
|
||||
GL::set_vertex_attribute(color_attribute, 0, 4);
|
||||
|
||||
GL::enable_blending(GL::BlendFactor::One, GL::BlendFactor::OneMinusSrcAlpha);
|
||||
GL::enable_blending(GL::BlendFactor::One, GL::BlendFactor::OneMinusSrcAlpha, GL::BlendFactor::One, GL::BlendFactor::One);
|
||||
GL::draw_arrays(GL::DrawPrimitive::Triangles, vertices.size() / 2);
|
||||
|
||||
GL::delete_buffer(vbo_vertices);
|
||||
|
@ -659,7 +659,7 @@ void Painter::blit_scaled_texture(Gfx::FloatRect const& dst_rect, GL::Texture co
|
|||
auto scaling_mode_gl = to_gl_scaling_mode(scaling_mode);
|
||||
GL::set_texture_scale_mode(scaling_mode_gl);
|
||||
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha);
|
||||
GL::enable_blending(GL::BlendFactor::SrcAlpha, GL::BlendFactor::OneMinusSrcAlpha, GL::BlendFactor::One, GL::BlendFactor::One);
|
||||
|
||||
GL::draw_arrays(GL::DrawPrimitive::TriangleFan, 4);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue