commit 73f49ed073517df2832714eea90085667fb0b9f7
parent a820d2ed08d9007a35eb6ea6522d17c7931cb884
Author: [email protected] <[email protected]>
Date: Thu, 24 Aug 2023 10:58:37 +0100
Fix missing copy constructor for MSVC
Diffstat:
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/include/kfr/graphics/geometry.hpp b/include/kfr/graphics/geometry.hpp
@@ -63,6 +63,7 @@ struct point
constexpr explicit point(const vec<T, 2>& v) noexcept : v(v) {}
constexpr point(T x, T y) noexcept : v(x, y) {}
constexpr point(const size<T>& sz) noexcept : v(sz.v) {}
+ constexpr point(const point& p) noexcept : v(p.v) {}
template <typename U>
operator point<U>() const
@@ -112,12 +113,12 @@ struct point
{
struct
{
- T x;
- T y;
+ vec<T, 2> v;
};
struct
{
- vec<T, 2> v;
+ T x;
+ T y;
};
struct
{
@@ -144,6 +145,7 @@ struct size
constexpr size(T x, T y) noexcept : v(x, y) {}
constexpr explicit size(T xy) noexcept : v(xy, xy) {}
constexpr size(const vec<T, 2>& v) noexcept : v(v) {}
+ constexpr size(const size& s) noexcept : v(s.v) {}
template <typename U>
operator size<U>() const noexcept
@@ -216,6 +218,7 @@ struct border
constexpr border(T h, T v) noexcept : v(h, v, h, v) {}
constexpr border(T x1, T y1, T x2, T y2) noexcept : v(x1, y1, x2, y2) {}
constexpr explicit border(const vec<T, 4>& v) : v(v) {}
+ constexpr border(const border& b) noexcept : v(b.v) {}
template <typename U>
operator border<U>() const
@@ -281,6 +284,7 @@ struct rectangle
constexpr rectangle(T x1, T y1, T x2, T y2) : v(x1, y1, x2, y2) {}
constexpr explicit rectangle(const vec<T, 4>& v) : v(v) {}
+ constexpr rectangle(const rectangle& r) noexcept : v(r.v) {}
template <typename U>
operator rectangle<U>() const
@@ -507,6 +511,7 @@ struct matrix2d
matrix2d() : v{ 1, 0, 0, 1, 0, 0 } {}
matrix2d(T a, T b, T c, T d, T e, T f) : v{ a, b, c, d, e, f } {}
+ constexpr matrix2d(const matrix2d& m) : v(m.v) {}
explicit matrix2d(const vec<T, 6>& v) : v(v) {}
diff --git a/tests/unit/graphics/geometry.cpp b/tests/unit/graphics/geometry.cpp
@@ -12,7 +12,7 @@ inline namespace CMT_ARCH_NAME
{
TEST(point)
{
- testo::eplison_scope<void> e(10);
+ testo::eplison_scope<void> e(100);
f32point p{ 0.f, 0.5f };
CHECK(p.distance(i32point{ 1, 2 }) == 1.80277563773f);
@@ -47,6 +47,7 @@ TEST(border)
TEST(rectangle)
{
+ testo::eplison_scope<void> e(100);
CHECK(f32rectangle{ f32point{ 1, 2 }, f32size{ 2, 2 } } == f32rectangle{ 1, 2, 3, 4 });
CHECK(f32rectangle{ f32point{ 1, 2 }, f32point{ 3, 4 } } == f32rectangle{ 1, 2, 3, 4 });
CHECK(f32rectangle{ f32point{ 1, 2 }, f32size{ 3, 4 }, f32point{ 0.5f, 0.5f } } ==