Skip to content

Commit 6fc74fc

Browse files
committed
fix test compilation
1 parent 14a3ee2 commit 6fc74fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1152
-1322
lines changed

PhotoshopAPI/src/Core/Geometry/BoundingBox.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "Point.h"
77

88
#include <array>
9+
#include <optional>
910

1011
PSAPI_NAMESPACE_BEGIN
1112

PhotoshopAPI/src/Core/Geometry/GeometryInstantiations.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
PSAPI_NAMESPACE_BEGIN
66

7+
namespace Geometry
8+
{
79

8-
template struct Face<double, 4>;
9-
template struct OctreeNode<double, 128>;
10-
template class Octree<double, 128>;
11-
template struct QuadMesh<double>;
10+
template struct Face<double, 4>;
11+
template struct OctreeNode<double, 128>;
12+
template class Octree<double, 128>;
13+
template struct QuadMesh<double>;
1214

15+
}
1316

1417
PSAPI_NAMESPACE_END

PhotoshopAPI/src/Core/Geometry/Mesh.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#pragma once
22

33
#include "Macros.h"
4+
#include "Util/Logger.h"
5+
#include "Util/Profiling/Perf/Instrumentor.h"
46

57
#include <vector>
68
#include <memory>
@@ -11,13 +13,7 @@
1113

1214
#include <Eigen/Dense>
1315

14-
// If we compile with C++<20 we replace the stdlib implementation with the compatibility
15-
// library
16-
#if (__cplusplus < 202002L)
17-
#include "tcb_span.hpp"
18-
#else
1916
#include <span>
20-
#endif
2117

2218

2319
PSAPI_NAMESPACE_BEGIN
@@ -91,12 +87,6 @@ namespace Geometry
9187
return m_VertexIndices.size();
9288
}
9389

94-
constexpr size_t vertex_idx_checked(size_t in_face_idx) const
95-
{
96-
static_assert(in_face_idx > _Size - 1, "Index out of bounds");
97-
return m_VertexIndices[in_face_idx];
98-
}
99-
10090
void vertex_indices(std::array<size_t, _Size> vertex_indices)
10191
{
10292
m_VertexIndices = vertex_indices;

PhotoshopAPI/src/Core/Geometry/MeshOperations.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <vector>
66
#include <memory>
77
#include <cmath>
8+
#include <execution>
89

910
#include "Point.h"
1011
#include "BoundingBox.h"

PhotoshopAPI/src/Core/Geometry/Point.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "Macros.h"
4+
#include "Util/Logger.h"
45

56
#include <vector>
67
#include <array>
@@ -9,13 +10,7 @@
910
#include <cassert>
1011
#include <algorithm>
1112

12-
// If we compile with C++<20 we replace the stdlib implementation with the compatibility
13-
// library
14-
#if (__cplusplus < 202002L)
15-
#include "tcb_span.hpp"
16-
#else
1713
#include <span>
18-
#endif
1914

2015
PSAPI_NAMESPACE_BEGIN
2116

@@ -135,6 +130,14 @@ namespace Geometry
135130
return std::hash<T>()(x) ^ (std::hash<T>()(y) << 1); // XOR combined with left shift for distribution
136131
}
137132

133+
// Provide a get<I> function for structured bindings
134+
template <std::size_t I>
135+
constexpr auto get(Point2D<T>& point)
136+
{
137+
if constexpr (I == 0) return point.x;
138+
else if constexpr (I == 1) return point.y;
139+
}
140+
138141
// Provide a get<I> function for structured bindings
139142
template <std::size_t I>
140143
constexpr auto& get(Point2D<T>& point)

PhotoshopAPI/src/Core/Render/ImageBuffer.h

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,8 @@
77
#include <cstdint>
88
#include <algorithm>
99
#include <type_traits>
10-
11-
12-
// If we compile with C++<20 we replace the stdlib implementation with the compatibility
13-
// library
14-
#if (__cplusplus < 202002L)
15-
#include "tcb_span.hpp"
16-
#else
10+
#include <filesystem>
1711
#include <span>
18-
#endif
1912

2013
#include "Core/Geometry/Point.h"
2114
#include "Core/Geometry/BoundingBox.h"
@@ -238,15 +231,15 @@ namespace Render
238231
// coordinate space of the original buffer rather than in our rescaled
239232
// buffer
240233
_Precision v = static_cast<_Precision>(y) / height;
241-
_Precision orig_y = (v * this->height) - .5;
234+
_Precision orig_y = static_cast<_Precision>((v * this->height) - .5);
242235
std::int64_t orig_y_int = static_cast<std::int64_t>(orig_y);
243236
_Precision orig_y_fract = orig_y - std::floor(orig_y);
244237

245238
std::array<T, 2 * 2> matrix;
246239
for (size_t x = 0; x < width; ++x)
247240
{
248241
_Precision u = static_cast<_Precision>(x) / width;
249-
_Precision orig_x = (u * this->width) - .5;
242+
_Precision orig_x = static_cast<_Precision>((u * this->width) - .5);
250243
std::int64_t orig_x_int = static_cast<std::int64_t>(orig_x);
251244
_Precision orig_x_fract = orig_x - std::floor(orig_x);
252245

@@ -297,7 +290,7 @@ namespace Render
297290
std::for_each(horizontal_iter.begin(), horizontal_iter.end(), [&](size_t x)
298291
{
299292
_Precision u = static_cast<_Precision>(x) / width;
300-
_Precision orig_x = (u * this->width) - .5;
293+
_Precision orig_x = static_cast<_Precision>((u * this->width) - .5);
301294
orig_x_int[x] = static_cast<std::int64_t>(orig_x);
302295
orig_x_fract[x] = orig_x - std::floor(orig_x);
303296
});
@@ -308,7 +301,7 @@ namespace Render
308301
// coordinate space of the original buffer rather than in our rescaled
309302
// buffer
310303
_Precision v = static_cast<_Precision>(y) / height;
311-
_Precision orig_y = (v * this->height) - .5;
304+
_Precision orig_y = static_cast<_Precision>((v * this->height) - .5);
312305
std::int64_t orig_y_int = static_cast<std::int64_t>(orig_y);
313306
_Precision orig_y_fract = orig_y - std::floor(orig_y);
314307

@@ -371,7 +364,7 @@ namespace Render
371364
{
372365
auto sample_point_or_black = [&](int64_t x, int64_t y)
373366
{
374-
if (x < 0 || y < 0 || x > this->width - 1 || y > this->height - 1) [[unlikely]]
367+
if (x < 0 || y < 0 || x > static_cast<int64_t>(this->width) - 1 || y > static_cast<int64_t>(this->height) - 1) [[unlikely]]
375368
{
376369
return static_cast<T>(0);
377370
}
@@ -386,8 +379,8 @@ namespace Render
386379
int64_t y1 = y0 + 1;
387380

388381
// Calculate weights
389-
U dx = point.x - static_cast<U>(x0);
390-
U dy = point.y - static_cast<U>(y0);
382+
float dx = static_cast<float>(point.x) - x0;
383+
float dy = static_cast<float>(point.y) - y0;
391384

392385
// Sample four surrounding pixels getting a black pixel instead of
393386
float v00 = sample_point_or_black(x0, y0);

PhotoshopAPI/src/Core/Render/Interleave.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "Macros.h"
44
#include "Util/Logger.h"
5+
#include "Util/Profiling/Perf/Instrumentor.h"
56

67
#include <vector>
78
#include <algorithm>

PhotoshopAPI/src/Core/Render/Render.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,15 @@ Support for this is still experimental and primarily for debug purposes
1414
#include <cmath>
1515
#include <algorithm>
1616
#include <tuple>
17+
#include <set>
18+
#include <span>
1719

1820
#include "ImageBuffer.h"
1921

2022
#include "Core/Geometry/Point.h"
2123
#include "Core/Geometry/Mesh.h"
2224
#include "Core/Geometry/BezierSurface.h"
2325

24-
// If we compile with C++<20 we replace the stdlib implementation with the compatibility
25-
// library
26-
#if (__cplusplus < 202002L)
27-
#include "tcb_span.hpp"
28-
#else
29-
#include <span>
30-
#endif
31-
3226
#include <OpenImageIO/imagebuf.h>
3327
#include <OpenImageIO/imagebufalgo.h>
3428

PhotoshopAPI/src/Core/Warp/SmartObjectWarp.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ namespace SmartObject
102102
auto bbox = warp_mesh.bbox();
103103
bbox.pad(static_cast<double>(supersample_resolution));
104104

105-
size_t min_y = static_cast<size_t>(std::max<double>(std::round(bbox.minimum.y), 0));
106-
size_t max_y = static_cast<size_t>(std::min<double>(std::round(bbox.maximum.y), buffer.height - 1));
107-
size_t min_x = static_cast<size_t>(std::max<double>(std::round(bbox.minimum.x), 0));
108-
size_t max_x = static_cast<size_t>(std::min<double>(std::round(bbox.maximum.x), buffer.width - 1));
105+
size_t min_y = static_cast<size_t>(std::max<double>(std::round(bbox.minimum.y), static_cast<double>(0)));
106+
size_t max_y = static_cast<size_t>(std::min<double>(std::round(bbox.maximum.y), static_cast<double>(buffer.height - 1)));
107+
size_t min_x = static_cast<size_t>(std::max<double>(std::round(bbox.minimum.x), static_cast<double>(0)));
108+
size_t max_x = static_cast<size_t>(std::min<double>(std::round(bbox.maximum.x), static_cast<double>(buffer.width - 1)));
109109

110110
auto vertical_iter = std::views::iota(min_y, max_y);
111111
std::for_each(std::execution::par_unseq, vertical_iter.begin(), vertical_iter.end(), [&](const size_t y)

0 commit comments

Comments
 (0)