summaryrefslogtreecommitdiff
path: root/user/sane/BTS-304.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/sane/BTS-304.patch')
-rw-r--r--user/sane/BTS-304.patch30
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;