Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions impeller/archivist/archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ArchiveDatabase;

class Archive {
public:
Archive(const std::string& path);
explicit Archive(const std::string& path);

~Archive();

Expand All @@ -45,7 +45,7 @@ class Archive {

template <class T,
class = std::enable_if_t<std::is_base_of<Archivable, T>::value>>
[[nodiscard]] size_t Read(UnarchiveStep stepper) {
[[nodiscard]] size_t Read(const UnarchiveStep& stepper) {
const ArchiveDef& def = T::kArchiveDefinition;
return UnarchiveInstances(def, stepper);
}
Expand Down
2 changes: 1 addition & 1 deletion impeller/archivist/archive_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct ArchiveDef;
///
class ArchiveDatabase {
public:
ArchiveDatabase(const std::string& filename);
explicit ArchiveDatabase(const std::string& filename);

~ArchiveDatabase();

Expand Down
2 changes: 1 addition & 1 deletion impeller/archivist/archive_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ArchiveVector : public Archivable {

ArchiveVector();

ArchiveVector(std::vector<int64_t> keys);
explicit ArchiveVector(std::vector<int64_t> keys);

ArchiveVector(const ArchiveVector&) = delete;

Expand Down
2 changes: 1 addition & 1 deletion impeller/compiler/compiler_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct CompilerBackend {

spirv_cross::Compiler* GetCompiler();

operator bool() const;
explicit operator bool() const;

enum class ExtendedResourceIndex {
kPrimary,
Expand Down
2 changes: 1 addition & 1 deletion impeller/compiler/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace compiler {

class AutoLogger {
public:
AutoLogger(std::stringstream& logger) : logger_(logger) {}
explicit AutoLogger(std::stringstream& logger) : logger_(logger) {}

~AutoLogger() {
logger_ << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion impeller/core/vertex_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct VertexBuffer {
size_t vertex_count = 0u;
IndexType index_type = IndexType::kUnknown;

constexpr operator bool() const {
constexpr explicit operator bool() const {
return static_cast<bool>(vertex_buffer) &&
(index_type == IndexType::kNone || static_cast<bool>(index_buffer));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class TextureFilterInput final : public FilterInput {
Matrix GetLocalTransform(const Entity& entity) const override;

private:
TextureFilterInput(std::shared_ptr<Texture> texture,
Matrix local_transform = Matrix());
explicit TextureFilterInput(std::shared_ptr<Texture> texture,
Matrix local_transform = Matrix());

std::shared_ptr<Texture> texture_;
Matrix local_transform_;
Expand Down
6 changes: 5 additions & 1 deletion impeller/geometry/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -840,10 +840,14 @@ struct Color {

static Color Random() {
return {
// This method is not used for cryptographic purposes.
// NOLINTBEGIN(clang-analyzer-security.insecureAPI.rand)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that's a lint I didn't expect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it makes sense most of the time, just not in this case!

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 //

};
}

Expand Down
8 changes: 4 additions & 4 deletions impeller/geometry/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
2 changes: 1 addition & 1 deletion impeller/geometry/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Path {
size_t contour_index) const;

private:
ReclaimPointBufferCallback reclaim_points;
ReclaimPointBufferCallback reclaim_points_;
};

Path();
Expand Down
4 changes: 2 additions & 2 deletions impeller/geometry/path_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 6 additions & 1 deletion impeller/geometry/rect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -211,7 +212,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
Expand Down