1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:47:34 +00:00

LibGfx: Add AffineTransform::map_to_quad(Rect)

Unlike map(Rect) which returns a Rect, mapping a Rect to a Quad allows
us to represent the actual result of mapping all four corners of the
Rect through the matrix.
This commit is contained in:
Andreas Kling 2022-04-07 14:05:30 +02:00
parent 5d8f4ab878
commit 2af8bb14d7
2 changed files with 15 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -37,6 +37,8 @@ public:
template<typename T>
Rect<T> map(Rect<T> const&) const;
Quad<float> map_to_quad(Rect<float> const&) const;
[[nodiscard]] ALWAYS_INLINE float a() const { return m_values[0]; }
[[nodiscard]] ALWAYS_INLINE float b() const { return m_values[1]; }
[[nodiscard]] ALWAYS_INLINE float c() const { return m_values[2]; }