From e0403d93a3ecf18b60d4ab919c5e9b3d7402daa4 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Tue, 9 Jun 2020 08:27:14 +0200 Subject: [PATCH] fixed palette/tv-effects slider rounding issue --- src/common/PaletteHandler.hxx | 2 +- src/common/tv_filters/NTSCFilter.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/PaletteHandler.hxx b/src/common/PaletteHandler.hxx index 3de835d7d..ed46da516 100644 --- a/src/common/PaletteHandler.hxx +++ b/src/common/PaletteHandler.hxx @@ -126,7 +126,7 @@ class PaletteHandler Convert adjustables from/to 100% scale */ static constexpr float scaleFrom100(float x) { return (x / 50.F) - 1.F; } - static constexpr uInt32 scaleTo100(float x) { return uInt32(50 * (x + 1.F)); } + static constexpr uInt32 scaleTo100(float x) { return uInt32(50.0001F * (x + 1.F)); } /** Convert palette settings name to enumeration. diff --git a/src/common/tv_filters/NTSCFilter.cxx b/src/common/tv_filters/NTSCFilter.cxx index 9764f1ac3..8e7e899c9 100644 --- a/src/common/tv_filters/NTSCFilter.cxx +++ b/src/common/tv_filters/NTSCFilter.cxx @@ -20,8 +20,8 @@ #include "NTSCFilter.hxx" -constexpr float scaleFrom100(float x) { return (x/50.F) - 1.F; } -constexpr uInt32 scaleTo100(float x) { return uInt32(50*(x+1.F)); } +constexpr float scaleFrom100(float x) { return (x / 50.F) - 1.F; } +constexpr uInt32 scaleTo100(float x) { return uInt32(50.0001F * (x + 1.F)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string NTSCFilter::setPreset(Preset preset)