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
9 changes: 6 additions & 3 deletions impeller/base/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ class IPLR_CAPABILITY("mutex") RWMutex {

class IPLR_SCOPED_CAPABILITY Lock {
public:
Lock(Mutex& mutex) IPLR_ACQUIRE(mutex) : mutex_(mutex) { mutex_.Lock(); }
explicit Lock(Mutex& mutex) IPLR_ACQUIRE(mutex) : mutex_(mutex) {
mutex_.Lock();
}

~Lock() IPLR_RELEASE() { mutex_.Unlock(); }

Expand All @@ -65,7 +67,8 @@ class IPLR_SCOPED_CAPABILITY Lock {

class IPLR_SCOPED_CAPABILITY ReaderLock {
public:
ReaderLock(RWMutex& mutex) IPLR_ACQUIRE_SHARED(mutex) : mutex_(mutex) {
explicit ReaderLock(RWMutex& mutex) IPLR_ACQUIRE_SHARED(mutex)
: mutex_(mutex) {
mutex_.LockReader();
}

Expand All @@ -79,7 +82,7 @@ class IPLR_SCOPED_CAPABILITY ReaderLock {

class IPLR_SCOPED_CAPABILITY WriterLock {
public:
WriterLock(RWMutex& mutex) IPLR_ACQUIRE(mutex) : mutex_(mutex) {
explicit WriterLock(RWMutex& mutex) IPLR_ACQUIRE(mutex) : mutex_(mutex) {
mutex_.LockWriter();
}

Expand Down
4 changes: 3 additions & 1 deletion impeller/base/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ struct Version {
size_t minor_version;
size_t patch_version;

constexpr Version(size_t p_major = 0, size_t p_minor = 0, size_t p_patch = 0)
constexpr explicit Version(size_t p_major = 0,
size_t p_minor = 0,
size_t p_patch = 0)
: major_version(p_major),
minor_version(p_minor),
patch_version(p_patch) {}
Expand Down
2 changes: 1 addition & 1 deletion impeller/geometry/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ struct Color {

explicit Color(const ColorHSB& hsbColor);

Color(const Vector4& value);
explicit Color(const Vector4& value);

constexpr Color(Scalar r, Scalar g, Scalar b, Scalar a)
: red(r), green(g), blue(b), alpha(a) {}
Expand Down
2 changes: 1 addition & 1 deletion impeller/geometry/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct Matrix {
Vector4(m12, m13, m14, m15)} {}
// clang-format on

Matrix(const MatrixDecomposition& decomposition);
explicit Matrix(const MatrixDecomposition& decomposition);

// clang-format off
static constexpr Matrix MakeColumn(
Expand Down
4 changes: 2 additions & 2 deletions impeller/golden_tests/metal_screenshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class MetalScreenshot {

private:
friend class MetalScreenshoter;
MetalScreenshot(CGImageRef cgImage);
explicit MetalScreenshot(CGImageRef cgImage);
FML_DISALLOW_COPY_AND_ASSIGN(MetalScreenshot);
CGImageRef cgImage_;
CGImageRef cg_image_;
CFDataRef pixel_data_;
};
} // namespace testing
Expand Down
10 changes: 5 additions & 5 deletions impeller/golden_tests/metal_screenshot.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@
namespace impeller {
namespace testing {

MetalScreenshot::MetalScreenshot(CGImageRef cgImage) : cgImage_(cgImage) {
MetalScreenshot::MetalScreenshot(CGImageRef cgImage) : cg_image_(cgImage) {
CGDataProviderRef data_provider = CGImageGetDataProvider(cgImage);
pixel_data_ = CGDataProviderCopyData(data_provider);
}

MetalScreenshot::~MetalScreenshot() {
CFRelease(pixel_data_);
CGImageRelease(cgImage_);
CGImageRelease(cg_image_);
}

const UInt8* MetalScreenshot::GetBytes() const {
return CFDataGetBytePtr(pixel_data_);
}

size_t MetalScreenshot::GetHeight() const {
return CGImageGetHeight(cgImage_);
return CGImageGetHeight(cg_image_);
}

size_t MetalScreenshot::GetWidth() const {
return CGImageGetWidth(cgImage_);
return CGImageGetWidth(cg_image_);
}

bool MetalScreenshot::WriteToPNG(const std::string& path) const {
Expand All @@ -36,7 +36,7 @@
CGImageDestinationRef destination = CGImageDestinationCreateWithURL(
(__bridge CFURLRef)output_url, kUTTypePNG, 1, nullptr);
if (destination != nullptr) {
CGImageDestinationAddImage(destination, cgImage_,
CGImageDestinationAddImage(destination, cg_image_,
(__bridge CFDictionaryRef) @{});

if (CGImageDestinationFinalize(destination)) {
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace impeller {
template <typename T>
class Pool {
public:
Pool(uint32_t limit_bytes) : limit_bytes_(limit_bytes), size_(0) {}
explicit Pool(uint32_t limit_bytes) : limit_bytes_(limit_bytes) {}

std::shared_ptr<T> Grab() {
std::scoped_lock lock(mutex_);
Expand Down Expand Up @@ -46,7 +46,7 @@ class Pool {
private:
std::vector<std::shared_ptr<T>> pool_;
const uint32_t limit_bytes_;
uint32_t size_;
uint32_t size_ = 0;
// Note: This would perform better as a lockless ring buffer.
mutable std::mutex mutex_;
};
Expand Down
4 changes: 2 additions & 2 deletions impeller/scene/importer/importer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ TEST(ImporterTest, CanParseSkinnedGLTF) {
ASSERT_COLOR_NEAR(color, Color(1, 1, 1, 1));

Vector4 joints = ToVector4(vertex.joints());
ASSERT_COLOR_NEAR(joints, Vector4(0, 0, 0, 0));
ASSERT_VECTOR4_NEAR(joints, Vector4(0, 0, 0, 0));

Vector4 weights = ToVector4(vertex.weights());
ASSERT_COLOR_NEAR(weights, Vector4(1, 0, 0, 0));
ASSERT_VECTOR4_NEAR(weights, Vector4(1, 0, 0, 0));

ASSERT_EQ(scene.animations.size(), 2u);
ASSERT_EQ(scene.animations[0]->name, "Idle");
Expand Down