mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
LibGfx/TIFF: Correctly upscale samples with a resolution lower than 8
As pointed out by @nico, while doing a right-shift to downscale is fine, a left-shift to upscale gives wrong results. As an example, imagine a 2- bits value containing 3, left-shifting it would give 192 instead of 255.
This commit is contained in:
parent
fc9a8c77d5
commit
7266d8c35d
1 changed files with 1 additions and 1 deletions
|
@ -83,7 +83,7 @@ private:
|
|||
|
||||
if (bits > 8)
|
||||
return value >> (bits - 8);
|
||||
return value << (8 - bits);
|
||||
return NumericLimits<u8>::max() * value / ((1 << bits) - 1);
|
||||
}
|
||||
|
||||
ErrorOr<Color> read_color(BigEndianInputBitStream& stream)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue