Skip to content

Commit 713191a

Browse files
tcl3gmta
authored andcommitted
LibGfx: Remove unused alpha premultiplication functions
1 parent d37eb3d commit 713191a

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

Libraries/LibGfx/Color.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -316,28 +316,6 @@ class Color {
316316
return color_with_alpha;
317317
}
318318

319-
constexpr Color to_premultiplied() const
320-
{
321-
u32 a = alpha();
322-
u8 r = static_cast<u8>((red() * a + 127) / 255);
323-
u8 g = static_cast<u8>((green() * a + 127) / 255);
324-
u8 b = static_cast<u8>((blue() * a + 127) / 255);
325-
return Color(r, g, b, a);
326-
}
327-
328-
constexpr Color to_unpremultiplied() const
329-
{
330-
u32 a = alpha();
331-
if (a == 0)
332-
return Color(0, 0, 0, 0);
333-
if (a == 255)
334-
return *this;
335-
u8 r = static_cast<u8>(min(255u, (red() * 255u + a / 2) / a));
336-
u8 g = static_cast<u8>(min(255u, (green() * 255u + a / 2) / a));
337-
u8 b = static_cast<u8>(min(255u, (blue() * 255u + a / 2) / a));
338-
return Color(r, g, b, a);
339-
}
340-
341319
constexpr Color blend(Color source) const
342320
{
343321
if (alpha() == 0 || source.alpha() == 255)

0 commit comments

Comments
 (0)