From 95878688a7492aac177aa4076817459950f2b4d4 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 1 Oct 2022 22:35:52 +0100 Subject: [PATCH] LibGfx: Add Matrix::operator+(Matrix const & other) --- Userland/Libraries/LibGfx/Matrix.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Userland/Libraries/LibGfx/Matrix.h b/Userland/Libraries/LibGfx/Matrix.h index cbb81daa3c..7931b3c92b 100644 --- a/Userland/Libraries/LibGfx/Matrix.h +++ b/Userland/Libraries/LibGfx/Matrix.h @@ -84,6 +84,16 @@ public: return product; } + constexpr Matrix operator+(Matrix const& other) const + { + Matrix sum; + for (size_t i = 0; i < N; ++i) { + for (size_t j = 0; j < N; ++j) + sum.m_elements[i][j] = m_elements[i][j] + other.m_elements[i][j]; + } + return sum; + } + constexpr Matrix operator/(T divisor) const { Matrix division;