diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2011-10-24 15:04:03 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-24 15:28:30 +0200 |
commit | 5453e78165af24d3124d127cb22c5799f9824794 (patch) | |
tree | d4236cf6256255687d4efe7e802b597268d588b9 | |
parent | 65b3819ab78979e422941fd1b5035b2b1d76655b (diff) |
Fix decimal point bug in Context2D color parsing
strtod() uses the locale's decimal point, which for
me is ','. But we want to always use '.' when parsing
color values for Context2D. qstrtod() does that.
This fixes two test failures in qquickcanvasitem.
Change-Id: I2ea58ad328f26903c57c7c80ed95fd24599805f4
Reviewed-by: Charles Yin <charles.yin@nokia.com>
-rw-r--r-- | src/declarative/items/context2d/qquickcontext2d.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/declarative/items/context2d/qquickcontext2d.cpp b/src/declarative/items/context2d/qquickcontext2d.cpp index 0c0865b3b3..ade890d943 100644 --- a/src/declarative/items/context2d/qquickcontext2d.cpp +++ b/src/declarative/items/context2d/qquickcontext2d.cpp @@ -95,6 +95,9 @@ QT_BEGIN_NAMESPACE the canvas. \image qml-item-canvas-context.gif */ + +Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok); + static const double Q_PI = 3.14159265358979323846; // pi #define DEGREES(t) ((t) * 180.0 / Q_PI) @@ -164,7 +167,8 @@ QColor qt_color_from_string(v8::Local<v8::Value> name) if (hasAlpha) { if (*p++!= ',') return QColor(); while (isspace(*p)) p++; - alpha = qRound(strtod(p, &p) * 255); + bool ok = false; + alpha = qRound(qstrtod(p, const_cast<const char **>(&p), &ok) * 255); } if (*p != ')') return QColor(); |