1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:07:35 +00:00

LibGfx: Fix direction of vertical gradients

Previously the color blending and alpha blending were working from
opposite sides.
This commit is contained in:
MacDue 2022-07-12 00:36:09 +01:00 committed by Sam Atkins
parent 03037cbe4e
commit eef148f7e7

View file

@ -265,7 +265,7 @@ void Painter::fill_rect_with_gradient(Orientation orientation, IntRect const& a_
float c = offset * increment;
float c_alpha = gradient_start.alpha() + offset * alpha_increment;
for (int i = clipped_rect.height() - 1; i >= 0; --i) {
auto color = gamma_accurate_blend(gradient_end, gradient_start, c);
auto color = gamma_accurate_blend(gradient_start, gradient_end, c);
color.set_alpha(c_alpha);
for (int j = 0; j < clipped_rect.width(); ++j) {
dst[j] = Color::from_argb(dst[j]).blend(color).value();