LibGfx: Slightly simplify Color::blend()

No behaviour change.
This commit is contained in:
MacDue 2024-01-05 23:28:38 +00:00 committed by Andreas Kling
parent 5c02b960ab
commit a1bafafd78

View file

@ -210,11 +210,10 @@ public:
if (source.alpha() == 0)
return *this;
int const d = 255 * (alpha() + source.alpha()) - alpha() * source.alpha();
u8 r = (red() * alpha() * (255 - source.alpha()) + source.red() * 255 * source.alpha()) / d;
u8 g = (green() * alpha() * (255 - source.alpha()) + source.green() * 255 * source.alpha()) / d;
u8 b = (blue() * alpha() * (255 - source.alpha()) + source.blue() * 255 * source.alpha()) / d;
u8 a = d / 255;
u8 a = 255 - ((255 - alpha()) * (255 - source.alpha()) / 255);
u8 r = (red() * (255 - source.alpha()) + source.red() * source.alpha()) / 255;
u8 g = (green() * (255 - source.alpha()) + source.green() * source.alpha()) / 255;
u8 b = (blue() * (255 - source.alpha()) + source.blue() * source.alpha()) / 255;
return Color(r, g, b, a);
}