mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-19 15:58:56 +00:00
LibSoftGPU: Drop unnecessary FP divisions in to_vec4
This commit is contained in:
parent
079c14931f
commit
ab6a869f55
Notes:
sideshowbarker
2024-07-17 21:56:19 +09:00
Author: https://github.com/gmta
Commit: ab6a869f55
Pull-request: https://github.com/SerenityOS/serenity/pull/11496
Reviewed-by: https://github.com/sunverwerth ✅
1 changed files with 5 additions and 4 deletions
|
@ -47,11 +47,12 @@ ALWAYS_INLINE constexpr static Gfx::RGBA32 to_rgba32(const FloatVector4& v)
|
||||||
|
|
||||||
static FloatVector4 to_vec4(Gfx::RGBA32 rgba)
|
static FloatVector4 to_vec4(Gfx::RGBA32 rgba)
|
||||||
{
|
{
|
||||||
|
auto constexpr one_over_255 = 1.0f / 255;
|
||||||
return {
|
return {
|
||||||
((rgba >> 16) & 0xff) / 255.0f,
|
((rgba >> 16) & 0xff) * one_over_255,
|
||||||
((rgba >> 8) & 0xff) / 255.0f,
|
((rgba >> 8) & 0xff) * one_over_255,
|
||||||
(rgba & 0xff) / 255.0f,
|
(rgba & 0xff) * one_over_255,
|
||||||
((rgba >> 24) & 0xff) / 255.0f
|
((rgba >> 24) & 0xff) * one_over_255,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue