mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibGfx: Remove unused alpha premultiplication functions
This commit is contained in:
parent
d37eb3de32
commit
713191a078
Notes:
github-actions[bot]
2025-11-05 14:40:20 +00:00
Author: https://github.com/tcl3
Commit: 713191a078
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6705
Reviewed-by: https://github.com/gmta ✅
1 changed files with 0 additions and 22 deletions
|
|
@ -316,28 +316,6 @@ public:
|
|||
return color_with_alpha;
|
||||
}
|
||||
|
||||
constexpr Color to_premultiplied() const
|
||||
{
|
||||
u32 a = alpha();
|
||||
u8 r = static_cast<u8>((red() * a + 127) / 255);
|
||||
u8 g = static_cast<u8>((green() * a + 127) / 255);
|
||||
u8 b = static_cast<u8>((blue() * a + 127) / 255);
|
||||
return Color(r, g, b, a);
|
||||
}
|
||||
|
||||
constexpr Color to_unpremultiplied() const
|
||||
{
|
||||
u32 a = alpha();
|
||||
if (a == 0)
|
||||
return Color(0, 0, 0, 0);
|
||||
if (a == 255)
|
||||
return *this;
|
||||
u8 r = static_cast<u8>(min(255u, (red() * 255u + a / 2) / a));
|
||||
u8 g = static_cast<u8>(min(255u, (green() * 255u + a / 2) / a));
|
||||
u8 b = static_cast<u8>(min(255u, (blue() * 255u + a / 2) / a));
|
||||
return Color(r, g, b, a);
|
||||
}
|
||||
|
||||
constexpr Color blend(Color source) const
|
||||
{
|
||||
if (alpha() == 0 || source.alpha() == 255)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue