mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-16 06:22:17 +00:00
LibGfx: Remove unnecessary divides in MatrixFilter
This commit is contained in:
parent
b877d71db7
commit
35809ef400
Notes:
sideshowbarker
2024-07-17 06:10:52 +09:00
Author: https://github.com/MacDue
Commit: 35809ef400
Pull-request: https://github.com/SerenityOS/serenity/pull/15463
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/awesomekling
1 changed files with 4 additions and 5 deletions
|
@ -23,14 +23,13 @@ public:
|
|||
protected:
|
||||
Color convert_color(Color original) override
|
||||
{
|
||||
auto constexpr u8_max = AK::NumericLimits<u8>::max();
|
||||
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 = {
|
||||
original.red() / float(u8_max),
|
||||
original.green() / float(u8_max),
|
||||
original.blue() / float(u8_max),
|
||||
float(original.red()),
|
||||
float(original.green()),
|
||||
float(original.blue())
|
||||
};
|
||||
rgb = m_operation * rgb;
|
||||
return Color {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue