mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
LibSoftGPU: Drop unnecessary FP divisions in to_vec4
This commit is contained in:
parent
079c14931f
commit
ab6a869f55
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