From ccb85ec65b2e3ab776c9de19267d9330096f7010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 15 Dec 2016 09:33:25 +0100 Subject: [PATCH] Math: pass largish things as const references instead of a copy. --- src/Magnum/Math/Color.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Magnum/Math/Color.h b/src/Magnum/Math/Color.h index bbd898d70..8609169be 100644 --- a/src/Magnum/Math/Color.h +++ b/src/Magnum/Math/Color.h @@ -39,7 +39,7 @@ namespace Magnum { namespace Math { namespace Implementation { /* Convert color from HSV */ -template typename std::enable_if::value, Color3>::type fromHsv(typename Color3::Hsv hsv) { +template typename std::enable_if::value, Color3>::type fromHsv(const typename Color3::Hsv& hsv) { Deg hue; T saturation, value; std::tie(hue, saturation, value) = hsv; @@ -65,7 +65,7 @@ template typename std::enable_if::value, Colo default: CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */ } } -template inline typename std::enable_if::value, Color3>::type fromHsv(typename Color3::Hsv hsv) { +template inline typename std::enable_if::value, Color3>::type fromHsv(const typename Color3::Hsv& hsv) { return denormalize>(fromHsv::FloatingPointType>(hsv)); } @@ -249,7 +249,7 @@ template class Color3: public Vector3 { * Hue can overflow the range @f$ [0.0, 360.0] @f$. * @see @ref toHsv() */ - static Color3 fromHsv(Hsv hsv) { + static Color3 fromHsv(const Hsv& hsv) { return Implementation::fromHsv(hsv); } /** @overload */ @@ -258,10 +258,10 @@ template class Color3: public Vector3 { } #ifdef MAGNUM_BUILD_DEPRECATED - /** @copybrief fromHsv(Hsv) - * @deprecated Use @ref fromHsv(Hsv) instead. + /** @copybrief fromHsv(const Hsv&) + * @deprecated Use @ref fromHsv(const Hsv&) instead. */ - CORRADE_DEPRECATED("use fromHsv() instead") static Color3 fromHSV(Hsv hsv) { + CORRADE_DEPRECATED("use fromHsv() instead") static Color3 fromHSV(const Hsv& hsv) { return fromHsv(hsv); } /** @copybrief fromHsv(Deg, FloatingPointType, FloatingPointType) @@ -341,7 +341,7 @@ template class Color3: public Vector3 { * std::tie(hue, saturation, value) = color.toHsv(); * @endcode * - * @see @ref hue(), @ref saturation(), @ref value(), @ref fromHSv() + * @see @ref hue(), @ref saturation(), @ref value(), @ref fromHsv() */ Hsv toHsv() const { return Implementation::toHsv(*this); @@ -489,7 +489,7 @@ class Color4: public Vector4 { * Hue can overflow the range @f$ [0.0, 360.0] @f$. * @see @ref toHsv() */ - static Color4 fromHsv(Hsv hsv, T a = Implementation::fullChannel()) { + static Color4 fromHsv(const Hsv& hsv, T a = Implementation::fullChannel()) { return Color4(Implementation::fromHsv(hsv), a); } /** @overload */ @@ -498,10 +498,10 @@ class Color4: public Vector4 { } #ifdef MAGNUM_BUILD_DEPRECATED - /** @copybrief fromHsv(Hsv, T) - * @deprecated Use @ref fromHsv(Hsv, T) instead. + /** @copybrief fromHsv(const Hsv&, T) + * @deprecated Use @ref fromHsv(const Hsv&, T) instead. */ - CORRADE_DEPRECATED("use fromHsv() instead") static Color4 fromHSV(Hsv hsv, T a = Implementation::fullChannel()) { + CORRADE_DEPRECATED("use fromHsv() instead") static Color4 fromHSV(const Hsv& hsv, T a = Implementation::fullChannel()) { return fromHsv(hsv, a); } /** @copybrief fromHsv(Deg, FloatingPointType, FloatingPointType, T)