mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
LibGfx: Slightly simplify Color::blend()
No behaviour change.
This commit is contained in:
parent
5c02b960ab
commit
a1bafafd78
1 changed files with 4 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue