mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
LibGfx: Remove unnecessary divides in MatrixFilter
This commit is contained in:
parent
b877d71db7
commit
35809ef400
1 changed files with 4 additions and 5 deletions
|
@ -23,14 +23,13 @@ public:
|
||||||
protected:
|
protected:
|
||||||
Color convert_color(Color original) override
|
Color convert_color(Color original) override
|
||||||
{
|
{
|
||||||
auto constexpr u8_max = AK::NumericLimits<u8>::max();
|
|
||||||
auto safe_float_to_u8 = [](float value) -> u8 {
|
auto safe_float_to_u8 = [](float value) -> u8 {
|
||||||
return AK::clamp(static_cast<int>(value * u8_max), 0, u8_max);
|
return AK::clamp(static_cast<int>(value), 0, AK::NumericLimits<u8>::max());
|
||||||
};
|
};
|
||||||
FloatVector3 rgb = {
|
FloatVector3 rgb = {
|
||||||
original.red() / float(u8_max),
|
float(original.red()),
|
||||||
original.green() / float(u8_max),
|
float(original.green()),
|
||||||
original.blue() / float(u8_max),
|
float(original.blue())
|
||||||
};
|
};
|
||||||
rgb = m_operation * rgb;
|
rgb = m_operation * rgb;
|
||||||
return Color {
|
return Color {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue