diff --git a/Userland/Libraries/LibGfx/Size.cpp b/Userland/Libraries/LibGfx/Size.cpp index 8d25838a48..28be84125a 100644 --- a/Userland/Libraries/LibGfx/Size.cpp +++ b/Userland/Libraries/LibGfx/Size.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Andreas Kling + * Copyright (c) 2020-2021, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ diff --git a/Userland/Libraries/LibGfx/Size.h b/Userland/Libraries/LibGfx/Size.h index 802c5ea03d..66814a1137 100644 --- a/Userland/Libraries/LibGfx/Size.h +++ b/Userland/Libraries/LibGfx/Size.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ @@ -59,28 +59,28 @@ public: ALWAYS_INLINE void scale_by(T dboth) { scale_by(dboth, dboth); } ALWAYS_INLINE void scale_by(Point const& s) { scale_by(s.x(), s.y()); } - Size scaled_by(T dx, T dy) const + [[nodiscard]] Size scaled_by(T dx, T dy) const { Size size = *this; size.scale_by(dx, dy); return size; } - Size scaled_by(T dboth) const + [[nodiscard]] Size scaled_by(T dboth) const { Size size = *this; size.scale_by(dboth); return size; } - Size scaled_by(Point const& s) const + [[nodiscard]] Size scaled_by(Point const& s) const { Size size = *this; size.scale_by(s); return size; } - Size transformed_by(AffineTransform const& transform) const + [[nodiscard]] Size transformed_by(AffineTransform const& transform) const { Size size = *this; size.transform_by(transform); @@ -88,19 +88,19 @@ public: } template - bool contains(Size const& other) const + [[nodiscard]] bool contains(Size const& other) const { return other.m_width <= m_width && other.m_height <= m_height; } template - bool operator==(Size const& other) const + [[nodiscard]] bool operator==(Size const& other) const { return width() == other.width() && height() == other.height(); } template - bool operator!=(Size const& other) const + [[nodiscard]] bool operator!=(Size const& other) const { return !(*this == other); } @@ -119,7 +119,7 @@ public: return *this; } - Size operator*(T factor) const { return { m_width * factor, m_height * factor }; } + [[nodiscard]] Size operator*(T factor) const { return { m_width * factor, m_height * factor }; } Size& operator*=(T factor) { @@ -128,7 +128,7 @@ public: return *this; } - T primary_size_for_orientation(Orientation orientation) const + [[nodiscard]] T primary_size_for_orientation(Orientation orientation) const { return orientation == Orientation::Vertical ? height() : width(); } @@ -142,7 +142,7 @@ public: } } - T secondary_size_for_orientation(Orientation orientation) const + [[nodiscard]] T secondary_size_for_orientation(Orientation orientation) const { return orientation == Orientation::Vertical ? width() : height(); } @@ -157,12 +157,12 @@ public: } template - ALWAYS_INLINE Size to_type() const + [[nodiscard]] ALWAYS_INLINE Size to_type() const { return Size(*this); } - String to_string() const; + [[nodiscard]] String to_string() const; private: T m_width { 0 };