mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
LibGfx: Add Matrix::operator*(T scalar)
This commit is contained in:
parent
95878688a7
commit
3d532571bb
Notes:
sideshowbarker
2024-07-17 06:26:23 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/3d532571bb Pull-request: https://github.com/SerenityOS/serenity/pull/15430 Reviewed-by: https://github.com/LucasChollet
1 changed files with 15 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue