Minor fixes for better STL compatibility.
Used by https://github.com/bdero/impeller-cmake
- Don't use std namespace for cmath functions.
- Directly include shared_ptr, unique_ptr, and array.
diff --git a/impeller/entity/geometry/vertices_geometry.cc b/impeller/entity/geometry/vertices_geometry.cc
index f9e86d4..5a1f290 100644
--- a/impeller/entity/geometry/vertices_geometry.cc
+++ b/impeller/entity/geometry/vertices_geometry.cc
@@ -5,6 +5,7 @@
#include "impeller/entity/geometry/vertices_geometry.h"
#include <cstdint>
+#include <cstring>
#include <utility>
#include "impeller/core/buffer_view.h"
@@ -173,7 +174,7 @@
.texture_coords = uv,
.color = has_colors ? colors_[i] : Color::BlackTransparent(),
};
- std::memcpy(vtx_contents++, &vertex_data, sizeof(VS::PerVertexData));
+ memcpy(vtx_contents++, &vertex_data, sizeof(VS::PerVertexData));
}
});
diff --git a/impeller/geometry/path.h b/impeller/geometry/path.h
index 0eebfab..2e68aba 100644
--- a/impeller/geometry/path.h
+++ b/impeller/geometry/path.h
@@ -6,6 +6,7 @@
#define FLUTTER_IMPELLER_GEOMETRY_PATH_H_
#include <functional>
+#include <memory>
#include <optional>
#include <tuple>
#include <vector>
diff --git a/impeller/geometry/path_component.cc b/impeller/geometry/path_component.cc
index 6c3492f..9e82989 100644
--- a/impeller/geometry/path_component.cc
+++ b/impeller/geometry/path_component.cc
@@ -161,7 +161,7 @@
void QuadraticPathComponent::ToLinearPathComponents(
Scalar scale,
VertexWriter& writer) const {
- Scalar line_count = std::ceilf(ComputeQuadradicSubdivisions(scale, *this));
+ Scalar line_count = ceilf(ComputeQuadradicSubdivisions(scale, *this));
for (size_t i = 1; i < line_count; i += 1) {
writer.Write(Solve(i / line_count));
}
@@ -179,8 +179,7 @@
void QuadraticPathComponent::ToLinearPathComponents(
Scalar scale_factor,
const PointProc& proc) const {
- Scalar line_count =
- std::ceilf(ComputeQuadradicSubdivisions(scale_factor, *this));
+ Scalar line_count = ceilf(ComputeQuadradicSubdivisions(scale_factor, *this));
for (size_t i = 1; i < line_count; i += 1) {
proc(Solve(i / line_count));
}
@@ -235,7 +234,7 @@
void CubicPathComponent::ToLinearPathComponents(Scalar scale,
VertexWriter& writer) const {
- Scalar line_count = std::ceilf(ComputeCubicSubdivisions(scale, *this));
+ Scalar line_count = ceilf(ComputeCubicSubdivisions(scale, *this));
for (size_t i = 1; i < line_count; i++) {
writer.Write(Solve(i / line_count));
}
@@ -259,7 +258,7 @@
void CubicPathComponent::ToLinearPathComponents(Scalar scale,
const PointProc& proc) const {
- Scalar line_count = std::ceilf(ComputeCubicSubdivisions(scale, *this));
+ Scalar line_count = ceilf(ComputeCubicSubdivisions(scale, *this));
for (size_t i = 1; i < line_count; i++) {
proc(Solve(i / line_count));
}
diff --git a/impeller/geometry/point.h b/impeller/geometry/point.h
index 02df4dc..51cd6cb 100644
--- a/impeller/geometry/point.h
+++ b/impeller/geometry/point.h
@@ -6,6 +6,7 @@
#define FLUTTER_IMPELLER_GEOMETRY_POINT_H_
#include <algorithm>
+#include <array>
#include <cmath>
#include <cstdint>
#include <ostream>
@@ -224,8 +225,8 @@
}
constexpr TPoint Rotate(const Radians& angle) const {
- const auto cos_a = std::cosf(angle.radians);
- const auto sin_a = std::sinf(angle.radians);
+ const auto cos_a = cosf(angle.radians);
+ const auto sin_a = sinf(angle.radians);
return {x * cos_a - y * sin_a, x * sin_a + y * cos_a};
}
diff --git a/impeller/typographer/rectangle_packer.cc b/impeller/typographer/rectangle_packer.cc
index 3ec7464..f9a7be8 100644
--- a/impeller/typographer/rectangle_packer.cc
+++ b/impeller/typographer/rectangle_packer.cc
@@ -5,6 +5,7 @@
#include "impeller/typographer/rectangle_packer.h"
#include <algorithm>
+#include <memory>
#include <vector>
#include "flutter/fml/logging.h"
diff --git a/impeller/typographer/rectangle_packer.h b/impeller/typographer/rectangle_packer.h
index 817bc66..d8b1e1c 100644
--- a/impeller/typographer/rectangle_packer.h
+++ b/impeller/typographer/rectangle_packer.h
@@ -9,6 +9,7 @@
#include "impeller/geometry/scalar.h"
#include <cstdint>
+#include <memory>
namespace impeller {