fix aa
This commit is contained in:
parent
55fbd59c36
commit
0dfc8cdf02
1 changed files with 14 additions and 7 deletions
|
@ -16,14 +16,21 @@ namespace bwidgets::core
|
|||
)
|
||||
noexcept
|
||||
{
|
||||
const auto d_clamp {std::abs(std::clamp<float>(d, -aa_pixels, 0))};
|
||||
const auto d_norm {d_clamp / aa_pixels};
|
||||
const auto factor {3 * d_norm * d_norm - 2 * d_norm * d_norm * d_norm};
|
||||
SDL_Color c {base_color};
|
||||
if (aa_pixels == 0)
|
||||
{
|
||||
if (d > 0) c.a = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto d_clamp {std::abs(std::clamp<float>(d, -aa_pixels, 0))};
|
||||
const auto d_norm {d_clamp / aa_pixels};
|
||||
const auto factor {3 * d_norm * d_norm - 2 * d_norm * d_norm * d_norm};
|
||||
|
||||
return {
|
||||
base_color.r, base_color.g, base_color.b,
|
||||
(uint8_t)(base_color.a * factor)
|
||||
};
|
||||
c.a *= factor;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
core::Texture* filled_circle(
|
||||
|
|
Loading…
Reference in a new issue