diff options
-rw-r--r-- | include/mbgl/util/color.hpp | 20 | ||||
-rw-r--r-- | src/mbgl/gl/value.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/gl/value.hpp | 4 |
3 files changed, 14 insertions, 14 deletions
diff --git a/include/mbgl/util/color.hpp b/include/mbgl/util/color.hpp index 178d0dc758..18e4747069 100644 --- a/include/mbgl/util/color.hpp +++ b/include/mbgl/util/color.hpp @@ -10,8 +10,8 @@ namespace mbgl { // Stores a premultiplied color, with all four channels ranging from 0..1 class Color { public: - constexpr Color() = default; - constexpr Color(float r_, float g_, float b_, float a_) + Color() = default; + Color(float r_, float g_, float b_, float a_) : r(r_), g(g_), b(b_), a(a_) { assert(r_ >= 0.0f); assert(r_ <= 1.0f); @@ -28,25 +28,25 @@ public: float b = 0.0f; float a = 0.0f; - static constexpr Color black() { return { 0.0f, 0.0f, 0.0f, 1.0f }; }; - static constexpr Color white() { return { 1.0f, 1.0f, 1.0f, 1.0f }; }; + static Color black() { return { 0.0f, 0.0f, 0.0f, 1.0f }; }; + static Color white() { return { 1.0f, 1.0f, 1.0f, 1.0f }; }; - static constexpr Color red() { return { 1.0f, 0.0f, 0.0f, 1.0f }; }; - static constexpr Color green() { return { 0.0f, 1.0f, 0.0f, 1.0f }; }; - static constexpr Color blue() { return { 0.0f, 0.0f, 1.0f, 1.0f }; }; + static Color red() { return { 1.0f, 0.0f, 0.0f, 1.0f }; }; + static Color green() { return { 0.0f, 1.0f, 0.0f, 1.0f }; }; + static Color blue() { return { 0.0f, 0.0f, 1.0f, 1.0f }; }; static optional<Color> parse(const std::string&); }; -constexpr bool operator==(const Color& colorA, const Color& colorB) { +inline bool operator==(const Color& colorA, const Color& colorB) { return colorA.r == colorB.r && colorA.g == colorB.g && colorA.b == colorB.b && colorA.a == colorB.a; } -constexpr bool operator!=(const Color& colorA, const Color& colorB) { +inline bool operator!=(const Color& colorA, const Color& colorB) { return !(colorA == colorB); } -constexpr Color operator*(const Color& color, float alpha) { +inline Color operator*(const Color& color, float alpha) { assert(alpha >= 0.0f); assert(alpha <= 1.0f); return { diff --git a/src/mbgl/gl/value.cpp b/src/mbgl/gl/value.cpp index 86218f3d9a..603d82dfd5 100644 --- a/src/mbgl/gl/value.cpp +++ b/src/mbgl/gl/value.cpp @@ -22,7 +22,7 @@ ClearDepth::Type ClearDepth::Get() { return clearDepth; } -const constexpr ClearColor::Type ClearColor::Default; +const ClearColor::Type ClearColor::Default { 0, 0, 0, 0 }; void ClearColor::Set(const Type& value) { MBGL_CHECK_ERROR(glClearColor(value.r, value.g, value.b, value.a)); @@ -205,7 +205,7 @@ BlendFunc::Type BlendFunc::Get() { static_cast<ColorMode::BlendFactor>(dfactor) }; } -const constexpr BlendColor::Type BlendColor::Default; +const BlendColor::Type BlendColor::Default { 0, 0, 0, 0 }; void BlendColor::Set(const Type& value) { MBGL_CHECK_ERROR(glBlendColor(value.r, value.g, value.b, value.a)); diff --git a/src/mbgl/gl/value.hpp b/src/mbgl/gl/value.hpp index 3586c26bda..eccd3e7373 100644 --- a/src/mbgl/gl/value.hpp +++ b/src/mbgl/gl/value.hpp @@ -21,7 +21,7 @@ struct ClearDepth { struct ClearColor { using Type = Color; - static const constexpr Type Default = { 0, 0, 0, 0 }; + static const Type Default; static void Set(const Type&); static Type Get(); }; @@ -142,7 +142,7 @@ constexpr bool operator!=(const BlendFunc::Type& a, const BlendFunc::Type& b) { struct BlendColor { using Type = Color; - static const constexpr Type Default = { 0, 0, 0, 0 }; + static const Type Default; static void Set(const Type&); static Type Get(); }; |