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
2 changes: 1 addition & 1 deletion impeller/image/backends/skia/compressed_image_skia.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CompressedImageSkia final : public CompressedImage {
static std::shared_ptr<CompressedImage> Create(
std::shared_ptr<const fml::Mapping> allocation);

CompressedImageSkia(std::shared_ptr<const fml::Mapping> allocation);
explicit CompressedImageSkia(std::shared_ptr<const fml::Mapping> allocation);

~CompressedImageSkia() override;

Expand Down
2 changes: 1 addition & 1 deletion impeller/playground/compute_playground_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ComputePlaygroundTest

template <typename T>
std::shared_ptr<DeviceBuffer> CreateHostVisibleDeviceBuffer(
std::shared_ptr<Context> context,
const std::shared_ptr<Context>& context,
const std::string& label) {
DeviceBufferDescriptor desc;
desc.storage_mode = StorageMode::kHostVisible;
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/metal/context_mtl.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ class ContextMTL final : public Context,
#endif // IMPELLER_DEBUG

// |Context|
void StoreTaskForGPU(std::function<void()> task) override;
void StoreTaskForGPU(const std::function<void()>& task) override;

private:
class SyncSwitchObserver : public fml::SyncSwitch::Observer {
public:
SyncSwitchObserver(ContextMTL& parent);
explicit SyncSwitchObserver(ContextMTL& parent);
virtual ~SyncSwitchObserver() = default;
void OnSyncSwitchUpdate(bool new_value) override;

Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/metal/context_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ new ContextMTL(device, command_queue,
return buffer;
}

void ContextMTL::StoreTaskForGPU(std::function<void()> task) {
tasks_awaiting_gpu_.emplace_back(std::move(task));
void ContextMTL::StoreTaskForGPU(const std::function<void()>& task) {
tasks_awaiting_gpu_.emplace_back(task);
while (tasks_awaiting_gpu_.size() > kMaxTasksAwaitingGPU) {
tasks_awaiting_gpu_.front()();
tasks_awaiting_gpu_.pop_front();
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/metal/sampler_library_mtl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SamplerLibraryMTL final
id<MTLDevice> device_ = nullptr;
SamplerMap samplers_;

SamplerLibraryMTL(id<MTLDevice> device);
explicit SamplerLibraryMTL(id<MTLDevice> device);

// |SamplerLibrary|
std::shared_ptr<const Sampler> GetSampler(
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/vulkan/blit_pass_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BlitPassVK final : public BlitPass {
std::vector<std::unique_ptr<BlitEncodeVK>> commands_;
std::string label_;

BlitPassVK(std::weak_ptr<CommandBufferVK> command_buffer);
explicit BlitPassVK(std::weak_ptr<CommandBufferVK> command_buffer);

// |BlitPass|
bool IsValid() const override;
Expand Down
1 change: 1 addition & 0 deletions impeller/renderer/backend/vulkan/shared_object_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class SharedObjectVKT : public SharedObjectVK {

explicit SharedObjectVKT(UniqueResource res) : resource_(std::move(res)) {}

// NOLINTNEXTLINE(google-explicit-constructor)
operator Resource() const { return Get(); }

const Resource& Get() const { return *resource_; }
Expand Down
8 changes: 4 additions & 4 deletions impeller/renderer/backend/vulkan/swapchain_impl_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ std::shared_ptr<Context> SwapchainImplVK::GetContext() const {
SwapchainImplVK::AcquireResult SwapchainImplVK::AcquireNextDrawable() {
auto context_strong = context_.lock();
if (!context_strong) {
return {};
return SwapchainImplVK::AcquireResult{};
}

const auto& context = ContextVK::Cast(*context_strong);
Expand All @@ -353,7 +353,7 @@ SwapchainImplVK::AcquireResult SwapchainImplVK::AcquireNextDrawable() {
///
if (!sync->WaitForFence(context.GetDevice())) {
VALIDATION_LOG << "Could not wait for fence.";
return {};
return SwapchainImplVK::AcquireResult{};
}

//----------------------------------------------------------------------------
Expand All @@ -368,7 +368,7 @@ SwapchainImplVK::AcquireResult SwapchainImplVK::AcquireNextDrawable() {
if (caps_result != vk::Result::eSuccess) {
VALIDATION_LOG << "Could not get surface capabilities: "
<< vk::to_string(caps_result);
return {};
return SwapchainImplVK::AcquireResult{};
}
if (caps.currentTransform != transform_if_changed_discard_swapchain_) {
transform_if_changed_discard_swapchain_ = caps.currentTransform;
Expand Down Expand Up @@ -404,7 +404,7 @@ SwapchainImplVK::AcquireResult SwapchainImplVK::AcquireNextDrawable() {

if (index >= images_.size()) {
VALIDATION_LOG << "Swapchain returned an invalid image index.";
return {};
return SwapchainImplVK::AcquireResult{};
}

/// Record all subsequent cmd buffers as part of the current frame.
Expand Down
5 changes: 3 additions & 2 deletions impeller/renderer/backend/vulkan/swapchain_impl_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ class SwapchainImplVK final
std::unique_ptr<Surface> surface;
bool out_of_date = false;

AcquireResult(bool p_out_of_date = false) : out_of_date(p_out_of_date) {}
explicit AcquireResult(bool p_out_of_date = false)
: out_of_date(p_out_of_date) {}

AcquireResult(std::unique_ptr<Surface> p_surface)
explicit AcquireResult(std::unique_ptr<Surface> p_surface)
: surface(std::move(p_surface)) {}
};

Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class Context {
/// Threadsafe.
///
/// `task` will be executed on the platform thread.
virtual void StoreTaskForGPU(std::function<void()> task) {
virtual void StoreTaskForGPU(const std::function<void()>& task) {
FML_CHECK(false && "not supported in this context");
}

Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class Renderer {

using RenderCallback = std::function<bool(RenderTarget& render_target)>;

Renderer(std::shared_ptr<Context> context,
size_t max_frames_in_flight = kDefaultMaxFramesInFlight);
explicit Renderer(std::shared_ptr<Context> context,
size_t max_frames_in_flight = kDefaultMaxFramesInFlight);

~Renderer();

Expand Down
7 changes: 4 additions & 3 deletions impeller/renderer/testing/mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ namespace testing {

class MockDeviceBuffer : public DeviceBuffer {
public:
MockDeviceBuffer(const DeviceBufferDescriptor& desc) : DeviceBuffer(desc) {}
explicit MockDeviceBuffer(const DeviceBufferDescriptor& desc)
: DeviceBuffer(desc) {}

MOCK_METHOD(bool, SetLabel, (const std::string& label), (override));

Expand Down Expand Up @@ -87,7 +88,7 @@ class MockBlitPass : public BlitPass {

class MockCommandBuffer : public CommandBuffer {
public:
MockCommandBuffer(std::weak_ptr<const Context> context)
explicit MockCommandBuffer(std::weak_ptr<const Context> context)
: CommandBuffer(context) {}
MOCK_METHOD(bool, IsValid, (), (const, override));
MOCK_METHOD(void, SetLabel, (const std::string& label), (const, override));
Expand Down Expand Up @@ -150,7 +151,7 @@ class MockImpellerContext : public Context {

class MockTexture : public Texture {
public:
MockTexture(const TextureDescriptor& desc) : Texture(desc) {}
explicit MockTexture(const TextureDescriptor& desc) : Texture(desc) {}
MOCK_METHOD(void, SetLabel, (std::string_view label), (override));
MOCK_METHOD(bool, IsValid, (), (const, override));
MOCK_METHOD(ISize, GetSize, (), (const, override));
Expand Down
2 changes: 1 addition & 1 deletion impeller/typographer/backends/skia/typeface_skia.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace impeller {
class TypefaceSkia final : public Typeface,
public BackendCast<TypefaceSkia, Typeface> {
public:
TypefaceSkia(sk_sp<SkTypeface> typeface);
explicit TypefaceSkia(sk_sp<SkTypeface> typeface);

~TypefaceSkia() override;

Expand Down
3 changes: 1 addition & 2 deletions impeller/typographer/backends/stb/typeface_stb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ namespace impeller {
// Instantiate a typeface based on a .ttf or other font file
TypefaceSTB::TypefaceSTB(std::unique_ptr<fml::Mapping> typeface_mapping)
: typeface_mapping_(std::move(typeface_mapping)),
font_info_(std::make_unique<stbtt_fontinfo>()),
is_valid_(false) {
font_info_(std::make_unique<stbtt_fontinfo>()) {
// We need an "offset" into the ttf file
auto offset = stbtt_GetFontOffsetForIndex(typeface_mapping_->GetMapping(), 0);
if (stbtt_InitFont(font_info_.get(), typeface_mapping_->GetMapping(),
Expand Down
2 changes: 1 addition & 1 deletion impeller/typographer/backends/stb/typeface_stb.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TypefaceSTB final : public Typeface,
private:
std::unique_ptr<fml::Mapping> typeface_mapping_;
std::unique_ptr<stbtt_fontinfo> font_info_;
bool is_valid_;
bool is_valid_ = false;

TypefaceSTB(const TypefaceSTB&) = delete;

Expand Down