1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

LibSoftGPU: Drop unnecessary FP divisions in to_vec4

This commit is contained in:
Jelle Raaijmakers 2021-12-30 00:35:40 +01:00 committed by Andreas Kling
parent 079c14931f
commit ab6a869f55

View file

@ -47,11 +47,12 @@ ALWAYS_INLINE constexpr static Gfx::RGBA32 to_rgba32(const FloatVector4& v)
static FloatVector4 to_vec4(Gfx::RGBA32 rgba)
{
auto constexpr one_over_255 = 1.0f / 255;
return {
((rgba >> 16) & 0xff) / 255.0f,
((rgba >> 8) & 0xff) / 255.0f,
(rgba & 0xff) / 255.0f,
((rgba >> 24) & 0xff) / 255.0f
((rgba >> 16) & 0xff) * one_over_255,
((rgba >> 8) & 0xff) * one_over_255,
(rgba & 0xff) * one_over_255,
((rgba >> 24) & 0xff) * one_over_255,
};
}