diff --git a/Userland/Libraries/LibGfx/Matrix.h b/Userland/Libraries/LibGfx/Matrix.h index 7931b3c92b..af7358c017 100644 --- a/Userland/Libraries/LibGfx/Matrix.h +++ b/Userland/Libraries/LibGfx/Matrix.h @@ -104,6 +104,21 @@ public: return division; } + friend constexpr Matrix operator*(Matrix const& matrix, T scalar) + { + Matrix scaled; + for (size_t i = 0; i < N; ++i) { + for (size_t j = 0; j < N; ++j) + scaled.m_elements[i][j] = matrix.m_elements[i][j] * scalar; + } + return scaled; + } + + friend constexpr Matrix operator*(T scalar, Matrix const& matrix) + { + return matrix * scalar; + } + [[nodiscard]] constexpr Matrix adjugate() const { if constexpr (N == 1)