diff options
author | Max Rees <maxcrees@me.com> | 2020-07-07 17:56:35 -0500 |
---|---|---|
committer | Max Rees <maxcrees@me.com> | 2020-07-07 17:56:35 -0500 |
commit | 3580df673d9dd6cb26e1e1cd38017029ca7ace79 (patch) | |
tree | 638ec84187c0bb794161f61dcd4181914543fe8c /user/sane/BTS-304.patch | |
parent | f5ad03e26a97b2a02e6ede4c7db3ea88a836e6c4 (diff) | |
download | packages-3580df673d9dd6cb26e1e1cd38017029ca7ace79.tar.gz packages-3580df673d9dd6cb26e1e1cd38017029ca7ace79.tar.bz2 packages-3580df673d9dd6cb26e1e1cd38017029ca7ace79.tar.xz packages-3580df673d9dd6cb26e1e1cd38017029ca7ace79.zip |
user/sane: add patch for #304 from @awilfox
Diffstat (limited to 'user/sane/BTS-304.patch')
-rw-r--r-- | user/sane/BTS-304.patch | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/user/sane/BTS-304.patch b/user/sane/BTS-304.patch new file mode 100644 index 000000000..64b7dca02 --- /dev/null +++ b/user/sane/BTS-304.patch @@ -0,0 +1,30 @@ +diff --git a/backend/genesys/image_pixel.cpp b/backend/genesys/image_pixel.cpp +index 1b83e127d..1ebba7fe0 100644 +--- a/backend/genesys/image_pixel.cpp ++++ b/backend/genesys/image_pixel.cpp +@@ -46,6 +46,7 @@ + #include "image.h" + + #include <array> ++#include <cmath> + + namespace genesys { + +@@ -207,7 +208,7 @@ void set_pixel_to_row(std::uint8_t* data, std::size_t x, Pixel pixel, PixelForma + float val = (pixel.r >> 8) * 0.3f; + val += (pixel.g >> 8) * 0.59f; + val += (pixel.b >> 8) * 0.11f; +- data[x] = static_cast<std::uint16_t>(val); ++ data[x] = static_cast<std::uint16_t>(roundf(val)); + return; + } + case PixelFormat::I16: { +@@ -215,7 +216,7 @@ void set_pixel_to_row(std::uint8_t* data, std::size_t x, Pixel pixel, PixelForma + float val = pixel.r * 0.3f; + val += pixel.g * 0.59f; + val += pixel.b * 0.11f; +- auto val16 = static_cast<std::uint16_t>(val); ++ auto val16 = static_cast<std::uint16_t>(roundf(val)); + data[x] = val16 & 0xff; + data[x + 1] = (val16 >> 8) & 0xff; + return; |