From dce3880d134e4f21c58de0270f7bbc60f66750fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 22 Apr 2016 16:46:14 +0200 Subject: [PATCH] Math: default-constructed Color4 should have zero alpha. Makes more sense than fully opaque black. On the other hand, creating Color4 from Color3 or separate RGB components still sets alpha to one, because that's the intuitive behavior. --- src/Magnum/Math/Color.h | 5 ++--- src/Magnum/Math/Test/ColorTest.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Magnum/Math/Color.h b/src/Magnum/Math/Color.h index 98a96311d..963cfb34e 100644 --- a/src/Magnum/Math/Color.h +++ b/src/Magnum/Math/Color.h @@ -445,10 +445,9 @@ class Color4: public Vector4 { /** * @brief Default constructor * - * RGB components are set to zero, A component is set to `1.0` for - * floating-point types and maximum positive value for integral types. + * All components are set to zero. */ - constexpr /*implicit*/ Color4(): Vector4(T(0), T(0), T(0), Implementation::fullChannel()) {} + constexpr /*implicit*/ Color4(): Vector4(T(0), T(0), T(0), T(0)) {} /** @copydoc Vector::Vector(ZeroInitT) */ constexpr explicit Color4(ZeroInitT) diff --git a/src/Magnum/Math/Test/ColorTest.cpp b/src/Magnum/Math/Test/ColorTest.cpp index 5da2518aa..32f3cbc65 100644 --- a/src/Magnum/Math/Test/ColorTest.cpp +++ b/src/Magnum/Math/Test/ColorTest.cpp @@ -125,7 +125,7 @@ void ColorTest::constructDefault() { constexpr Color4 b; constexpr Color4ub c; - CORRADE_COMPARE(b, Color4(0.0f, 0.0f, 0.0f, 1.0f)); + CORRADE_COMPARE(b, Color4(0.0f, 0.0f, 0.0f, 0.0f)); CORRADE_COMPARE(c, Color4ub(0, 0, 0, 255)); }