Make impeller/geometry/... compatible with .clang-tidy. (flutter/engine#48154)
This commit is contained in:
@@ -840,10 +840,14 @@ struct Color {
|
||||
|
||||
static Color Random() {
|
||||
return {
|
||||
// This method is not used for cryptographic purposes.
|
||||
// NOLINTBEGIN(clang-analyzer-security.insecureAPI.rand)
|
||||
static_cast<Scalar>((std::rand() % 255) / 255.0f), //
|
||||
static_cast<Scalar>((std::rand() % 255) / 255.0f), //
|
||||
static_cast<Scalar>((std::rand() % 255) / 255.0f), //
|
||||
1.0f //
|
||||
// NOLINTEND(clang-analyzer-security.insecureAPI.rand)
|
||||
1.0f //
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -228,20 +228,20 @@ bool Path::GetContourComponentAtIndex(size_t index,
|
||||
|
||||
Path::Polyline::Polyline(Path::Polyline::PointBufferPtr point_buffer,
|
||||
Path::Polyline::ReclaimPointBufferCallback reclaim)
|
||||
: points(std::move(point_buffer)), reclaim_points(std::move(reclaim)) {
|
||||
: points(std::move(point_buffer)), reclaim_points_(std::move(reclaim)) {
|
||||
FML_DCHECK(points);
|
||||
}
|
||||
|
||||
Path::Polyline::Polyline(Path::Polyline&& other) {
|
||||
points = std::move(other.points);
|
||||
reclaim_points = std::move(other.reclaim_points);
|
||||
reclaim_points_ = std::move(other.reclaim_points_);
|
||||
contours = std::move(other.contours);
|
||||
}
|
||||
|
||||
Path::Polyline::~Polyline() {
|
||||
if (reclaim_points) {
|
||||
if (reclaim_points_) {
|
||||
points->clear();
|
||||
reclaim_points(std::move(points));
|
||||
reclaim_points_(std::move(points));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ class Path {
|
||||
size_t contour_index) const;
|
||||
|
||||
private:
|
||||
ReclaimPointBufferCallback reclaim_points;
|
||||
ReclaimPointBufferCallback reclaim_points_;
|
||||
};
|
||||
|
||||
Path();
|
||||
|
||||
@@ -102,7 +102,7 @@ struct CubicPathComponent {
|
||||
|
||||
CubicPathComponent() {}
|
||||
|
||||
CubicPathComponent(const QuadraticPathComponent& q)
|
||||
explicit CubicPathComponent(const QuadraticPathComponent& q)
|
||||
: p1(q.p1),
|
||||
cp1(q.p1 + (q.cp - q.p1) * (2.0 / 3.0)),
|
||||
cp2(q.p2 + (q.cp - q.p2) * (2.0 / 3.0)),
|
||||
@@ -148,7 +148,7 @@ struct ContourComponent {
|
||||
|
||||
ContourComponent() {}
|
||||
|
||||
ContourComponent(Point p, bool is_closed = false)
|
||||
explicit ContourComponent(Point p, bool is_closed = false)
|
||||
: destination(p), is_closed(is_closed) {}
|
||||
|
||||
bool operator==(const ContourComponent& other) const {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
||||
#include "fml/logging.h"
|
||||
#include "impeller/geometry/matrix.h"
|
||||
#include "impeller/geometry/point.h"
|
||||
#include "impeller/geometry/scalar.h"
|
||||
@@ -216,7 +217,11 @@ struct TRect {
|
||||
/// rectangle.
|
||||
constexpr TRect TransformBounds(const Matrix& transform) const {
|
||||
auto points = GetTransformedPoints(transform);
|
||||
return TRect::MakePointBounds(points.begin(), points.end()).value();
|
||||
auto bounds = TRect::MakePointBounds(points.begin(), points.end());
|
||||
if (bounds.has_value()) {
|
||||
return bounds.value();
|
||||
}
|
||||
FML_UNREACHABLE();
|
||||
}
|
||||
|
||||
/// @brief Constructs a Matrix that will map all points in the coordinate
|
||||
|
||||
Reference in New Issue
Block a user