diff options
author | Aki Koskinen <aki@secondlion.fi> | 2016-11-27 16:34:48 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2016-11-29 16:54:28 -0200 |
commit | 5e790774917beacfc1a17997f8f705d195320451 (patch) | |
tree | f6251b3f6f15edcb12ff9c3e91b6711307332594 /src | |
parent | 3d2d57cd30aae8d2811f679fcb30fd0e8f2ab2e9 (diff) | |
download | qtlocation-mapboxgl-5e790774917beacfc1a17997f8f705d195320451.tar.gz |
Always use a dot as a decimal point in string, independent of locale
std::to_string() potentially uses a decimal point character different
than a dot (.), depending on the environment's locale. But since this
generated string will be part of GLSL code, there needs to be a dot and
nothing else.
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/programs/program.hpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp index c912de13fe..e5aae24997 100644 --- a/src/mbgl/programs/program.hpp +++ b/src/mbgl/programs/program.hpp @@ -3,6 +3,7 @@ #include <mbgl/gl/program.hpp> #include <mbgl/programs/program_parameters.hpp> +#include <sstream> #include <cassert> namespace mbgl { @@ -17,7 +18,11 @@ public: {} static std::string pixelRatioDefine(const ProgramParameters& parameters) { - return std::string("#define DEVICE_PIXEL_RATIO ") + std::to_string(parameters.pixelRatio) + "\n"; + std::ostringstream pixelRatioSS; + pixelRatioSS.imbue(std::locale("C")); + pixelRatioSS.setf(std::ios_base::showpoint); + pixelRatioSS << parameters.pixelRatio; + return std::string("#define DEVICE_PIXEL_RATIO ") + pixelRatioSS.str() + "\n"; } static std::string fragmentSource(const ProgramParameters& parameters) { |