mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibGfx: Round values in Color::with_opacity()
`svg-gradient-userSpaceOnUse` is now rendered to something closer to what firefox does, so it is at least some progress.
This commit is contained in:
parent
b4ba65c6e5
commit
248e4bb517
Notes:
github-actions[bot]
2024-11-21 12:00:54 +00:00
Author: https://github.com/LucasChollet Commit: https://github.com/LadybirdBrowser/ladybird/commit/248e4bb517c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2390 Reviewed-by: https://github.com/gmta
4 changed files with 3 additions and 2 deletions
|
@ -400,7 +400,8 @@ public:
|
||||||
|
|
||||||
constexpr Color with_opacity(float opacity) const
|
constexpr Color with_opacity(float opacity) const
|
||||||
{
|
{
|
||||||
return with_alpha(alpha() * opacity);
|
VERIFY(opacity >= 0 && opacity <= 1);
|
||||||
|
return with_alpha(static_cast<u8>(round(alpha() * opacity)));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Color darkened(float amount = 0.5f) const
|
constexpr Color darkened(float amount = 0.5f) const
|
||||||
|
|
|
@ -25,5 +25,6 @@ TEST_CASE(all_green)
|
||||||
TEST_CASE(hsv)
|
TEST_CASE(hsv)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(Color(51, 179, 51), Color::from_hsv(120, 0.714285714, .7));
|
EXPECT_EQ(Color(51, 179, 51), Color::from_hsv(120, 0.714285714, .7));
|
||||||
|
EXPECT_EQ(Color(51, 179, 51, 128), Color::from_hsv(120, 0.714285714, .7).with_opacity(0.5));
|
||||||
EXPECT_EQ(Color(87, 128, 77), Color::from_hsv(108, 0.4, .5));
|
EXPECT_EQ(Color(87, 128, 77), Color::from_hsv(108, 0.4, .5));
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.2 KiB |
|
@ -165,5 +165,4 @@ Text/input/test-http-test-server.html
|
||||||
|
|
||||||
; Multiple bugs are affecting these tests. To avoid having to rebase them every
|
; Multiple bugs are affecting these tests. To avoid having to rebase them every
|
||||||
; single time, let's deactivate them for a bit.
|
; single time, let's deactivate them for a bit.
|
||||||
Ref/input/color-hwb.html
|
|
||||||
Screenshot/input/css-color-functions.html
|
Screenshot/input/css-color-functions.html
|
||||||
|
|
Loading…
Reference in a new issue