From f2e20ba5c0a31ad58e3530ca673c6a632d524599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 11 Sep 2015 17:54:03 +0200 Subject: [PATCH] Math: default alpha parameter also for Color4::fromHSV(). Not sure why this was omitted. --- src/Magnum/Math/Color.h | 2 +- src/Magnum/Math/Test/ColorTest.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Math/Color.h b/src/Magnum/Math/Color.h index ef01d0658..949438720 100644 --- a/src/Magnum/Math/Color.h +++ b/src/Magnum/Math/Color.h @@ -438,7 +438,7 @@ class Color4: public Vector4 { return Color4(Implementation::fromHSV(hsv), a); } /** @overload */ - constexpr static Color4 fromHSV(Deg hue, FloatingPointType saturation, FloatingPointType value, T alpha) { + constexpr static Color4 fromHSV(Deg hue, FloatingPointType saturation, FloatingPointType value, T alpha = Implementation::fullChannel()) { return fromHSV(std::make_tuple(hue, saturation, value), alpha); } diff --git a/src/Magnum/Math/Test/ColorTest.cpp b/src/Magnum/Math/Test/ColorTest.cpp index e7b7d3155..770602039 100644 --- a/src/Magnum/Math/Test/ColorTest.cpp +++ b/src/Magnum/Math/Test/ColorTest.cpp @@ -313,6 +313,10 @@ void ColorTest::hsvOverflow() { void ColorTest::hsvAlpha() { CORRADE_COMPARE(Color4ub::fromHSV(std::make_tuple(230.0_degf, 0.749f, 0.427f), 23), Color4ub(27, 40, 108, 23)); CORRADE_COMPARE(Color4ub::fromHSV(230.0_degf, 0.749f, 0.427f, 23), Color4ub(27, 40, 108, 23)); + + /* Default alpha */ + CORRADE_COMPARE(Color4ub::fromHSV(std::make_tuple(230.0_degf, 0.749f, 0.427f)), Color4ub(27, 40, 108, 255)); + CORRADE_COMPARE(Color4ub::fromHSV(230.0_degf, 0.749f, 0.427f), Color4ub(27, 40, 108, 255)); } void ColorTest::swizzleType() {