summaryrefslogtreecommitdiff
path: root/src/mbgl/programs
diff options
context:
space:
mode:
authorAki Koskinen <aki@secondlion.fi>2016-11-27 16:34:48 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2016-11-29 16:54:28 -0200
commit5e790774917beacfc1a17997f8f705d195320451 (patch)
treef6251b3f6f15edcb12ff9c3e91b6711307332594 /src/mbgl/programs
parent3d2d57cd30aae8d2811f679fcb30fd0e8f2ab2e9 (diff)
downloadqtlocation-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/mbgl/programs')
-rw-r--r--src/mbgl/programs/program.hpp7
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) {