mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:58:12 +00:00
LibGfx: Templatize Gfx::Triangle
Previously this was limited to integer triangles, but I want to use it with floats, so let's start by templatizing the class.
This commit is contained in:
parent
f602bbf135
commit
1f346a490b
3 changed files with 34 additions and 22 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Shannon Booth <shannon.ml.booth@gmail.com>
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -9,7 +10,14 @@
|
|||
|
||||
namespace Gfx {
|
||||
|
||||
String Triangle::to_string() const
|
||||
template<>
|
||||
String Triangle<int>::to_string() const
|
||||
{
|
||||
return String::formatted("({},{},{})", m_a, m_b, m_c);
|
||||
}
|
||||
|
||||
template<>
|
||||
String Triangle<float>::to_string() const
|
||||
{
|
||||
return String::formatted("({},{},{})", m_a, m_b, m_c);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue