From cb4c9f47278477202f371d9d6128fa9297e9948c Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Wed, 26 Oct 2022 01:19:12 -0700 Subject: [PATCH] Clang-tidy: made verbose print out commands and fixed quoting problem for warnings as errors (flutter/engine#37015) --- .../display_list/display_list_builder.cc | 43 ++++++----- engine/src/flutter/flow/compositor_context.cc | 3 +- engine/src/flutter/flow/diff_context.cc | 2 +- .../flutter/impeller/aiks/aiks_unittests.cc | 17 +++-- engine/src/flutter/impeller/aiks/canvas.cc | 75 ++++++++++--------- engine/src/flutter/impeller/aiks/canvas.h | 36 +++++---- engine/src/flutter/impeller/aiks/paint.cc | 15 ++-- engine/src/flutter/impeller/aiks/paint.h | 4 +- .../impeller/aiks/paint_pass_delegate.cc | 2 +- .../impeller/base/work_queue_common.cc | 2 +- .../flutter/impeller/blobcat/blob_library.cc | 11 +-- .../flutter/impeller/blobcat/blob_library.h | 7 +- .../flutter/impeller/blobcat/blob_writer.cc | 3 +- .../display_list/display_list_dispatcher.cc | 59 ++++++++------- .../display_list/nine_patch_converter.cc | 4 +- .../display_list/nine_patch_converter.h | 4 +- .../entity/contents/atlas_contents.cc | 7 +- .../impeller/entity/contents/clip_contents.cc | 2 +- .../entity/contents/content_context.cc | 4 +- .../entity/contents/content_context.h | 5 +- .../contents/filters/color_filter_contents.cc | 8 +- .../contents/filters/filter_contents.cc | 19 ++--- .../entity/contents/filters/filter_contents.h | 2 +- .../filters/gaussian_blur_filter_contents.cc | 3 +- .../entity/contents/gradient_generator.cc | 2 +- .../entity/contents/gradient_generator.h | 2 +- .../entity/contents/solid_color_contents.cc | 4 +- .../entity/contents/solid_color_contents.h | 3 +- .../impeller/entity/contents/text_contents.cc | 24 +++--- .../impeller/entity/contents/text_contents.h | 2 +- .../entity/contents/texture_contents.cc | 7 +- .../entity/contents/texture_contents.h | 2 +- .../flutter/impeller/entity/entity_pass.cc | 12 +-- .../src/flutter/impeller/entity/entity_pass.h | 7 +- .../impeller/entity/entity_unittests.cc | 8 +- .../src/flutter/impeller/entity/geometry.cc | 21 +++--- engine/src/flutter/impeller/entity/geometry.h | 13 ++-- .../src/flutter/impeller/geometry/gradient.cc | 4 +- .../backend/gles/playground_impl_gles.cc | 2 +- .../playground/imgui/imgui_impl_impeller.cc | 3 +- .../playground/imgui/imgui_impl_impeller.h | 2 +- .../backend/metal/compute_pipeline_mtl.h | 2 +- .../backend/metal/compute_pipeline_mtl.mm | 4 +- .../flutter/impeller/renderer/blit_pass.cc | 5 +- .../impeller/renderer/compute_command.cc | 33 ++++---- .../impeller/renderer/compute_command.h | 10 +-- .../impeller/renderer/shader_library.cc | 11 ++- .../runtime_stage/runtime_stage_unittests.cc | 5 +- .../impeller/typographer/glyph_atlas.cc | 4 +- .../impeller/typographer/lazy_glyph_atlas.cc | 5 +- .../typographer/text_render_context.cc | 4 +- ...isplay_list_deferred_image_gpu_impeller.cc | 4 +- .../display_list_deferred_image_gpu_skia.cc | 16 ++-- ...rm_message_response_dart_port_unittests.cc | 2 +- ...latform_message_response_dart_unittests.cc | 2 +- .../src/flutter/runtime/runtime_controller.cc | 3 +- .../src/flutter/shell/common/platform_view.cc | 14 ++-- .../common/snapshot_controller_impeller.cc | 2 +- .../common/snapshot_controller_impeller.h | 2 +- .../shell/common/snapshot_controller_skia.cc | 2 +- .../shell/gpu/gpu_surface_metal_impeller.h | 2 +- .../shell/gpu/gpu_surface_metal_impeller.mm | 2 +- .../embedder/tests/embedder_unittests_util.cc | 5 +- .../embedder/tests/embedder_unittests_util.h | 3 +- .../flutter/testing/display_list_testing.cc | 2 +- .../tools/clang_tidy/lib/src/command.dart | 3 +- 66 files changed, 327 insertions(+), 275 deletions(-) diff --git a/engine/src/flutter/display_list/display_list_builder.cc b/engine/src/flutter/display_list/display_list_builder.cc index 11a990e27f..ccef2769ae 100644 --- a/engine/src/flutter/display_list/display_list_builder.cc +++ b/engine/src/flutter/display_list/display_list_builder.cc @@ -863,7 +863,7 @@ void DisplayListBuilder::drawPoints(SkCanvas::PointMode mode, } void DisplayListBuilder::drawSkVertices(const sk_sp vertices, SkBlendMode mode) { - Push(0, 1, std::move(vertices), mode); + Push(0, 1, vertices, mode); // DrawVertices applies its colors to the paint so we have no way // of controlling opacity using the current paint attributes. // Although, examination of the |mode| might find some predictable @@ -892,8 +892,8 @@ void DisplayListBuilder::drawImage(const sk_sp image, DlImageSampling sampling, bool render_with_attributes) { render_with_attributes - ? Push(0, 1, std::move(image), point, sampling) - : Push(0, 1, std::move(image), point, sampling); + ? Push(0, 1, image, point, sampling) + : Push(0, 1, image, point, sampling); CheckLayerOpacityCompatibility(render_with_attributes); } void DisplayListBuilder::drawImage(const sk_sp& image, @@ -914,8 +914,8 @@ void DisplayListBuilder::drawImageRect(const sk_sp image, DlImageSampling sampling, bool render_with_attributes, SkCanvas::SrcRectConstraint constraint) { - Push(0, 1, std::move(image), src, dst, sampling, - render_with_attributes, constraint); + Push(0, 1, image, src, dst, sampling, render_with_attributes, + constraint); CheckLayerOpacityCompatibility(render_with_attributes); } void DisplayListBuilder::drawImageRect(const sk_sp& image, @@ -938,9 +938,8 @@ void DisplayListBuilder::drawImageNine(const sk_sp image, DlFilterMode filter, bool render_with_attributes) { render_with_attributes - ? Push(0, 1, std::move(image), center, dst, - filter) - : Push(0, 1, std::move(image), center, dst, filter); + ? Push(0, 1, image, center, dst, filter) + : Push(0, 1, image, center, dst, filter); CheckLayerOpacityCompatibility(render_with_attributes); } void DisplayListBuilder::drawImageNine(const sk_sp& image, @@ -971,9 +970,9 @@ void DisplayListBuilder::drawImageLattice(const sk_sp image, (x_div_count + y_div_count) * sizeof(int) + cell_count * (sizeof(SkColor) + sizeof(SkCanvas::Lattice::RectType)); SkIRect src = lattice.fBounds ? *lattice.fBounds : image->bounds(); - void* pod = this->Push( - bytes, 1, std::move(image), x_div_count, y_div_count, cell_count, src, - dst, filter, render_with_attributes); + void* pod = this->Push(bytes, 1, image, x_div_count, + y_div_count, cell_count, src, dst, + filter, render_with_attributes); CopyV(pod, lattice.fXDivs, x_div_count, lattice.fYDivs, y_div_count, lattice.fColors, cell_count, lattice.fRectTypes, cell_count); CheckLayerOpacityCompatibility(render_with_attributes); @@ -992,22 +991,22 @@ void DisplayListBuilder::drawAtlas(const sk_sp atlas, if (colors != nullptr) { bytes += count * sizeof(DlColor); if (cull_rect != nullptr) { - data_ptr = Push(bytes, 1, std::move(atlas), count, - mode, sampling, true, *cull_rect, - render_with_attributes); + data_ptr = + Push(bytes, 1, atlas, count, mode, sampling, true, + *cull_rect, render_with_attributes); } else { - data_ptr = Push(bytes, 1, std::move(atlas), count, mode, - sampling, true, render_with_attributes); + data_ptr = Push(bytes, 1, atlas, count, mode, sampling, true, + render_with_attributes); } CopyV(data_ptr, xform, count, tex, count, colors, count); } else { if (cull_rect != nullptr) { - data_ptr = Push(bytes, 1, std::move(atlas), count, - mode, sampling, false, *cull_rect, - render_with_attributes); + data_ptr = + Push(bytes, 1, atlas, count, mode, sampling, false, + *cull_rect, render_with_attributes); } else { - data_ptr = Push(bytes, 1, std::move(atlas), count, mode, - sampling, false, render_with_attributes); + data_ptr = Push(bytes, 1, atlas, count, mode, sampling, + false, render_with_attributes); } CopyV(data_ptr, xform, count, tex, count); } @@ -1069,7 +1068,7 @@ void DisplayListBuilder::drawDisplayList( void DisplayListBuilder::drawTextBlob(const sk_sp blob, SkScalar x, SkScalar y) { - Push(0, 1, std::move(blob), x, y); + Push(0, 1, blob, x, y); CheckLayerOpacityCompatibility(); } void DisplayListBuilder::drawShadow(const SkPath& path, diff --git a/engine/src/flutter/flow/compositor_context.cc b/engine/src/flutter/flow/compositor_context.cc index b40df6a186..891a1cd6a0 100644 --- a/engine/src/flutter/flow/compositor_context.cc +++ b/engine/src/flutter/flow/compositor_context.cc @@ -81,7 +81,8 @@ std::unique_ptr CompositorContext::AcquireFrame( const SkMatrix& root_surface_transformation, bool instrumentation_enabled, bool surface_supports_readback, - fml::RefPtr raster_thread_merger, + fml::RefPtr + raster_thread_merger, // NOLINT(performance-unnecessary-value-param) DisplayListBuilder* display_list_builder) { return std::make_unique( *this, gr_context, canvas, view_embedder, root_surface_transformation, diff --git a/engine/src/flutter/flow/diff_context.cc b/engine/src/flutter/flow/diff_context.cc index 6e57ac4623..a828dcef96 100644 --- a/engine/src/flutter/flow/diff_context.cc +++ b/engine/src/flutter/flow/diff_context.cc @@ -202,7 +202,7 @@ void DiffContext::AddReadbackRegion(const SkIRect& rect) { readback.position = rects_->size(); // Push empty rect as a placeholder for position in current subtree rects_->push_back(SkRect::MakeEmpty()); - readbacks_.push_back(std::move(readback)); + readbacks_.push_back(readback); } PaintRegion DiffContext::CurrentSubtreeRegion() const { diff --git a/engine/src/flutter/impeller/aiks/aiks_unittests.cc b/engine/src/flutter/impeller/aiks/aiks_unittests.cc index 26aadbeee8..ab4b76ab66 100644 --- a/engine/src/flutter/impeller/aiks/aiks_unittests.cc +++ b/engine/src/flutter/impeller/aiks/aiks_unittests.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include "flutter/testing/testing.h" #include "impeller/aiks/aiks_playground.h" @@ -74,7 +75,7 @@ TEST_P(AiksTest, CanRenderImage) { ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); } -bool GenerateMipmap(std::shared_ptr context, +bool GenerateMipmap(const std::shared_ptr& context, std::shared_ptr texture, std::string label) { auto buffer = context->CreateCommandBuffer(); @@ -85,7 +86,7 @@ bool GenerateMipmap(std::shared_ptr context, if (!pass) { return false; } - pass->GenerateMipmap(texture, label); + pass->GenerateMipmap(std::move(texture), std::move(label)); pass->EncodeCommands(context->GetResourceAllocator()); return true; } @@ -481,8 +482,8 @@ TEST_P(AiksTest, CanRenderLinearGradientWayManyColors) { colors = std::move(colors)]() { auto contents = std::make_shared(); contents->SetEndPoints({0, 0}, {200, 200}); - contents->SetColors(std::move(colors)); - contents->SetStops(std::move(stops)); + contents->SetColors(colors); + contents->SetStops(stops); contents->SetTileMode(tile_mode); contents->SetMatrix(matrix); return contents; @@ -1077,7 +1078,7 @@ TEST_P(AiksTest, CanRenderDifferencePaths) { canvas.DrawImage( std::make_shared(CreateTextureForFixture("boston.jpg")), {10, 10}, Paint{}); - canvas.DrawPath(std::move(path), paint); + canvas.DrawPath(path, paint); ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); } @@ -1097,7 +1098,7 @@ static sk_sp OpenFixtureAsSkData(const char* fixture_name) { return data; } -bool RenderTextInCanvas(std::shared_ptr context, +bool RenderTextInCanvas(const std::shared_ptr& context, Canvas& canvas, const std::string& text, const std::string& font_fixture, @@ -1129,7 +1130,7 @@ bool RenderTextInCanvas(std::shared_ptr context, Paint text_paint; text_paint.color = Color::Yellow(); - canvas.DrawTextFrame(std::move(frame), text_position, text_paint); + canvas.DrawTextFrame(frame, text_position, text_paint); return true; } @@ -1725,7 +1726,7 @@ TEST_P(AiksTest, SaveLayerFiltersScaleWithTransform) { canvas.Translate(Vector2(100, 100)); auto texture = std::make_shared(CreateTextureForFixture("boston.jpg")); - auto draw_image_layer = [&canvas, &texture](Paint paint) { + auto draw_image_layer = [&canvas, &texture](const Paint& paint) { canvas.SaveLayer(paint); canvas.DrawImage(texture, {}, Paint{}); canvas.Restore(); diff --git a/engine/src/flutter/impeller/aiks/canvas.cc b/engine/src/flutter/impeller/aiks/canvas.cc index 1b0b4ccef6..0eb0da65c1 100644 --- a/engine/src/flutter/impeller/aiks/canvas.cc +++ b/engine/src/flutter/impeller/aiks/canvas.cc @@ -6,6 +6,7 @@ #include #include +#include #include "flutter/fml/logging.h" #include "impeller/aiks/paint_pass_delegate.h" @@ -55,13 +56,13 @@ void Canvas::Save( if (create_subpass) { entry.is_subpass = true; auto subpass = std::make_unique(); - subpass->SetBackdropFilter(backdrop_filter); + subpass->SetBackdropFilter(std::move(backdrop_filter)); subpass->SetBlendMode(blend_mode); current_pass_ = GetCurrentPass().AddSubpass(std::move(subpass)); current_pass_->SetTransformation(xformation_stack_.back().xformation); current_pass_->SetStencilDepth(xformation_stack_.back().stencil_depth); } - xformation_stack_.emplace_back(std::move(entry)); + xformation_stack_.emplace_back(entry); } bool Canvas::Restore() { @@ -136,25 +137,24 @@ void Canvas::RestoreToCount(size_t count) { } } -void Canvas::DrawPath(Path path, Paint paint) { +void Canvas::DrawPath(const Path& path, const Paint& paint) { Entity entity; entity.SetTransformation(GetCurrentTransformation()); entity.SetStencilDepth(GetStencilDepth()); entity.SetBlendMode(paint.blend_mode); - entity.SetContents( - paint.WithFilters(paint.CreateContentsForEntity(std::move(path)))); + entity.SetContents(paint.WithFilters(paint.CreateContentsForEntity(path))); - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); } -void Canvas::DrawPaint(Paint paint) { +void Canvas::DrawPaint(const Paint& paint) { Entity entity; entity.SetTransformation(GetCurrentTransformation()); entity.SetStencilDepth(GetStencilDepth()); entity.SetBlendMode(paint.blend_mode); entity.SetContents(paint.CreateContentsForEntity({}, true)); - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); } bool Canvas::AttemptDrawBlurredRRect(const Rect& rect, @@ -182,7 +182,7 @@ bool Canvas::AttemptDrawBlurredRRect(const Rect& rect, entity.SetBlendMode(paint.blend_mode); entity.SetContents(paint.WithFilters(std::move(contents))); - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); return true; } @@ -199,25 +199,23 @@ void Canvas::DrawRect(Rect rect, Paint paint) { entity.SetContents(paint.WithFilters( paint.CreateContentsForGeometry(Geometry::MakeRect(rect)))); - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); } void Canvas::DrawRRect(Rect rect, Scalar corner_radius, Paint paint) { if (AttemptDrawBlurredRRect(rect, corner_radius, paint)) { return; } - DrawPath(PathBuilder{}.AddRoundedRect(rect, corner_radius).TakePath(), - std::move(paint)); + DrawPath(PathBuilder{}.AddRoundedRect(rect, corner_radius).TakePath(), paint); } -void Canvas::DrawCircle(Point center, Scalar radius, Paint paint) { - DrawPath(PathBuilder{}.AddCircle(center, radius).TakePath(), - std::move(paint)); +void Canvas::DrawCircle(Point center, Scalar radius, const Paint& paint) { + DrawPath(PathBuilder{}.AddCircle(center, radius).TakePath(), paint); } -void Canvas::ClipPath(Path path, Entity::ClipOperation clip_op) { +void Canvas::ClipPath(const Path& path, Entity::ClipOperation clip_op) { auto contents = std::make_shared(); - contents->SetGeometry(Geometry::MakeFillPath(std::move(path))); + contents->SetGeometry(Geometry::MakeFillPath(path)); contents->SetClipOperation(clip_op); Entity entity; @@ -225,7 +223,7 @@ void Canvas::ClipPath(Path path, Entity::ClipOperation clip_op) { entity.SetContents(std::move(contents)); entity.SetStencilDepth(GetStencilDepth()); - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); ++xformation_stack_.back().stencil_depth; xformation_stack_.back().contains_clips = true; @@ -239,7 +237,7 @@ void Canvas::RestoreClip() { entity.SetContents(std::make_shared()); entity.SetStencilDepth(GetStencilDepth()); - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); } void Canvas::DrawPicture(Picture picture) { @@ -257,9 +255,9 @@ void Canvas::DrawPicture(Picture picture) { return; } -void Canvas::DrawImage(std::shared_ptr image, +void Canvas::DrawImage(const std::shared_ptr& image, Point offset, - Paint paint, + const Paint& paint, SamplerDescriptor sampler) { if (!image) { return; @@ -269,13 +267,13 @@ void Canvas::DrawImage(std::shared_ptr image, const auto dest = Rect::MakeXYWH(offset.x, offset.y, source.size.width, source.size.height); - DrawImageRect(image, source, dest, std::move(paint), std::move(sampler)); + DrawImageRect(image, source, dest, paint, std::move(sampler)); } -void Canvas::DrawImageRect(std::shared_ptr image, +void Canvas::DrawImageRect(const std::shared_ptr& image, Rect source, Rect dest, - Paint paint, + const Paint& paint, SamplerDescriptor sampler) { if (!image || source.size.IsEmpty() || dest.size.IsEmpty()) { return; @@ -299,7 +297,7 @@ void Canvas::DrawImageRect(std::shared_ptr image, entity.SetContents(paint.WithFilters(contents, false)); entity.SetTransformation(GetCurrentTransformation()); - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); } Picture Canvas::EndRecordingAsPicture() { @@ -321,9 +319,10 @@ size_t Canvas::GetStencilDepth() const { return xformation_stack_.back().stencil_depth; } -void Canvas::SaveLayer(Paint paint, - std::optional bounds, - std::optional backdrop_filter) { +void Canvas::SaveLayer( + const Paint& paint, + std::optional bounds, + const std::optional& backdrop_filter) { Save(true, paint.blend_mode, backdrop_filter); auto& new_layer_pass = GetCurrentPass(); @@ -340,13 +339,15 @@ void Canvas::SaveLayer(Paint paint, } } -void Canvas::DrawTextFrame(TextFrame text_frame, Point position, Paint paint) { +void Canvas::DrawTextFrame(const TextFrame& text_frame, + Point position, + const Paint& paint) { auto lazy_glyph_atlas = GetCurrentPass().GetLazyGlyphAtlas(); lazy_glyph_atlas->AddTextFrame(text_frame); auto text_contents = std::make_shared(); - text_contents->SetTextFrame(std::move(text_frame)); + text_contents->SetTextFrame(text_frame); text_contents->SetGlyphAtlas(std::move(lazy_glyph_atlas)); text_contents->SetColor(paint.color); @@ -357,13 +358,13 @@ void Canvas::DrawTextFrame(TextFrame text_frame, Point position, Paint paint) { entity.SetBlendMode(paint.blend_mode); entity.SetContents(paint.WithFilters(std::move(text_contents), true)); - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); } -void Canvas::DrawVertices(Vertices vertices, +void Canvas::DrawVertices(const Vertices& vertices, BlendMode blend_mode, Paint paint) { - auto geometry = Geometry::MakeVertices(std::move(vertices)); + auto geometry = Geometry::MakeVertices(vertices); Entity entity; entity.SetTransformation(GetCurrentTransformation()); @@ -385,17 +386,17 @@ void Canvas::DrawVertices(Vertices vertices, entity.SetContents(paint.WithFilters(std::move(contents), true)); } - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); } -void Canvas::DrawAtlas(std::shared_ptr atlas, +void Canvas::DrawAtlas(const std::shared_ptr& atlas, std::vector transforms, std::vector texture_coordinates, std::vector colors, BlendMode blend_mode, SamplerDescriptor sampler, std::optional cull_rect, - Paint paint) { + const Paint& paint) { if (!atlas) { return; } @@ -421,7 +422,7 @@ void Canvas::DrawAtlas(std::shared_ptr atlas, entity.SetBlendMode(paint.blend_mode); entity.SetContents(paint.WithFilters(contents, false)); - GetCurrentPass().AddEntity(std::move(entity)); + GetCurrentPass().AddEntity(entity); } } // namespace impeller diff --git a/engine/src/flutter/impeller/aiks/canvas.h b/engine/src/flutter/impeller/aiks/canvas.h index e9fbb5351d..d911b8150c 100644 --- a/engine/src/flutter/impeller/aiks/canvas.h +++ b/engine/src/flutter/impeller/aiks/canvas.h @@ -35,10 +35,10 @@ class Canvas { void Save(); - void SaveLayer( - Paint paint, - std::optional bounds = std::nullopt, - std::optional backdrop_filter = std::nullopt); + void SaveLayer(const Paint& paint, + std::optional bounds = std::nullopt, + const std::optional& backdrop_filter = + std::nullopt); bool Restore(); @@ -66,45 +66,49 @@ class Canvas { void Rotate(Radians radians); - void DrawPath(Path path, Paint paint); + void DrawPath(const Path& path, const Paint& paint); - void DrawPaint(Paint paint); + void DrawPaint(const Paint& paint); void DrawRect(Rect rect, Paint paint); void DrawRRect(Rect rect, Scalar corner_radius, Paint paint); - void DrawCircle(Point center, Scalar radius, Paint paint); + void DrawCircle(Point center, Scalar radius, const Paint& paint); - void DrawImage(std::shared_ptr image, + void DrawImage(const std::shared_ptr& image, Point offset, - Paint paint, + const Paint& paint, SamplerDescriptor sampler = {}); - void DrawImageRect(std::shared_ptr image, + void DrawImageRect(const std::shared_ptr& image, Rect source, Rect dest, - Paint paint, + const Paint& paint, SamplerDescriptor sampler = {}); void ClipPath( - Path path, + const Path& path, Entity::ClipOperation clip_op = Entity::ClipOperation::kIntersect); void DrawPicture(Picture picture); - void DrawTextFrame(TextFrame text_frame, Point position, Paint paint); + void DrawTextFrame(const TextFrame& text_frame, + Point position, + const Paint& paint); - void DrawVertices(Vertices vertices, BlendMode blend_mode, Paint paint); + void DrawVertices(const Vertices& vertices, + BlendMode blend_mode, + Paint paint); - void DrawAtlas(std::shared_ptr atlas, + void DrawAtlas(const std::shared_ptr& atlas, std::vector transforms, std::vector texture_coordinates, std::vector colors, BlendMode blend_mode, SamplerDescriptor sampler, std::optional cull_rect, - Paint paint); + const Paint& paint); Picture EndRecordingAsPicture(); diff --git a/engine/src/flutter/impeller/aiks/paint.cc b/engine/src/flutter/impeller/aiks/paint.cc index 6b134037a7..d88043c8c3 100644 --- a/engine/src/flutter/impeller/aiks/paint.cc +++ b/engine/src/flutter/impeller/aiks/paint.cc @@ -8,19 +8,18 @@ namespace impeller { -std::shared_ptr Paint::CreateContentsForEntity(Path path, +std::shared_ptr Paint::CreateContentsForEntity(const Path& path, bool cover) const { std::unique_ptr geometry; switch (style) { case Style::kFill: - geometry = cover ? Geometry::MakeCover() - : Geometry::MakeFillPath(std::move(path)); + geometry = cover ? Geometry::MakeCover() : Geometry::MakeFillPath(path); break; case Style::kStroke: - geometry = cover ? Geometry::MakeCover() - : Geometry::MakeStrokePath(std::move(path), stroke_width, - stroke_miter, stroke_cap, - stroke_join); + geometry = + cover ? Geometry::MakeCover() + : Geometry::MakeStrokePath(path, stroke_width, stroke_miter, + stroke_cap, stroke_join); break; } return CreateContentsForGeometry(std::move(geometry)); @@ -97,7 +96,7 @@ std::shared_ptr Paint::WithColorFilter( } std::shared_ptr Paint::MaskBlurDescriptor::CreateMaskBlur( - FilterInput::Ref input, + const FilterInput::Ref& input, bool is_solid_color, const Matrix& effect_transform) const { if (is_solid_color) { diff --git a/engine/src/flutter/impeller/aiks/paint.h b/engine/src/flutter/impeller/aiks/paint.h index 9f45539eee..536eae3fbe 100644 --- a/engine/src/flutter/impeller/aiks/paint.h +++ b/engine/src/flutter/impeller/aiks/paint.h @@ -41,7 +41,7 @@ struct Paint { Sigma sigma; std::shared_ptr CreateMaskBlur( - FilterInput::Ref input, + const FilterInput::Ref& input, bool is_solid_color, const Matrix& effect_matrix) const; }; @@ -88,7 +88,7 @@ struct Paint { std::shared_ptr input, const Matrix& effect_transform = Matrix()) const; - std::shared_ptr CreateContentsForEntity(Path path = {}, + std::shared_ptr CreateContentsForEntity(const Path& path = {}, bool cover = false) const; std::shared_ptr CreateContentsForGeometry( diff --git a/engine/src/flutter/impeller/aiks/paint_pass_delegate.cc b/engine/src/flutter/impeller/aiks/paint_pass_delegate.cc index 47e795f4ca..a06128a534 100644 --- a/engine/src/flutter/impeller/aiks/paint_pass_delegate.cc +++ b/engine/src/flutter/impeller/aiks/paint_pass_delegate.cc @@ -11,7 +11,7 @@ namespace impeller { PaintPassDelegate::PaintPassDelegate(Paint paint, std::optional coverage) - : paint_(std::move(paint)), coverage_(std::move(coverage)) {} + : paint_(std::move(paint)), coverage_(coverage) {} // |EntityPassDelgate| PaintPassDelegate::~PaintPassDelegate() = default; diff --git a/engine/src/flutter/impeller/base/work_queue_common.cc b/engine/src/flutter/impeller/base/work_queue_common.cc index 9a1f062014..e23e95ad9e 100644 --- a/engine/src/flutter/impeller/base/work_queue_common.cc +++ b/engine/src/flutter/impeller/base/work_queue_common.cc @@ -19,7 +19,7 @@ WorkQueueCommon::~WorkQueueCommon() { // |WorkQueue| void WorkQueueCommon::PostTask(fml::closure task) { - loop_->GetTaskRunner()->PostTask(std::move(task)); + loop_->GetTaskRunner()->PostTask(task); } } // namespace impeller diff --git a/engine/src/flutter/impeller/blobcat/blob_library.cc b/engine/src/flutter/impeller/blobcat/blob_library.cc index 02ba647adc..5377fc236d 100644 --- a/engine/src/flutter/impeller/blobcat/blob_library.cc +++ b/engine/src/flutter/impeller/blobcat/blob_library.cc @@ -6,6 +6,7 @@ #include #include +#include #include "impeller/base/validation.h" #include "impeller/blobcat/blob_flatbuffers.h" @@ -74,16 +75,16 @@ std::shared_ptr BlobLibrary::GetMapping(BlobShaderType type, std::string name) const { BlobKey key; key.type = type; - key.name = name; + key.name = std::move(name); auto found = blobs_.find(key); return found == blobs_.end() ? nullptr : found->second; } size_t BlobLibrary::IterateAllBlobs( - std::function& mapping)> callback) - const { + const std::function& mapping)>& + callback) const { if (!IsValid() || !callback) { return 0u; } diff --git a/engine/src/flutter/impeller/blobcat/blob_library.h b/engine/src/flutter/impeller/blobcat/blob_library.h index 7d5a8b598f..4a8809590f 100644 --- a/engine/src/flutter/impeller/blobcat/blob_library.h +++ b/engine/src/flutter/impeller/blobcat/blob_library.h @@ -31,9 +31,10 @@ class BlobLibrary { std::string name) const; size_t IterateAllBlobs( - std::function& mapping)>) const; + const std::function& mapping)>&) + const; private: struct BlobKey { diff --git a/engine/src/flutter/impeller/blobcat/blob_writer.cc b/engine/src/flutter/impeller/blobcat/blob_writer.cc index d3ff7b6242..bafebbec2b 100644 --- a/engine/src/flutter/impeller/blobcat/blob_writer.cc +++ b/engine/src/flutter/impeller/blobcat/blob_writer.cc @@ -68,8 +68,7 @@ bool BlobWriter::AddBlobAtPath(const std::string& std_path) { return false; } - return AddBlob(shader_type.value(), std::move(shader_name), - std::move(file_mapping)); + return AddBlob(shader_type.value(), shader_name, std::move(file_mapping)); } bool BlobWriter::AddBlob(BlobShaderType type, diff --git a/engine/src/flutter/impeller/display_list/display_list_dispatcher.cc b/engine/src/flutter/impeller/display_list/display_list_dispatcher.cc index ad4dd2e4aa..853db4b528 100644 --- a/engine/src/flutter/impeller/display_list/display_list_dispatcher.cc +++ b/engine/src/flutter/impeller/display_list/display_list_dispatcher.cc @@ -9,6 +9,7 @@ #include #include #include +#include #include "display_list/display_list_blend_mode.h" #include "display_list/display_list_color_filter.h" @@ -349,8 +350,8 @@ void DisplayListDispatcher::setColorSource( paint_.color_source = [start_point, end_point, colors = std::move(colors), stops = std::move(stops), tile_mode, matrix]() { auto contents = std::make_shared(); - contents->SetColors(std::move(colors)); - contents->SetStops(std::move(stops)); + contents->SetColors(colors); + contents->SetStops(stops); contents->SetEndPoints(start_point, end_point); contents->SetTileMode(tile_mode); contents->SetMatrix(matrix); @@ -373,8 +374,8 @@ void DisplayListDispatcher::setColorSource( paint_.color_source = [center, radius, colors = std::move(colors), stops = std::move(stops), tile_mode, matrix]() { auto contents = std::make_shared(); - contents->SetColors(std::move(colors)); - contents->SetStops(std::move(stops)); + contents->SetColors(colors); + contents->SetStops(stops); contents->SetCenterAndRadius(center, radius); contents->SetTileMode(tile_mode); contents->SetMatrix(matrix); @@ -401,8 +402,8 @@ void DisplayListDispatcher::setColorSource( stops = std::move(stops), tile_mode, matrix]() { auto contents = std::make_shared(); contents->SetCenterAndAngles(center, start_angle, end_angle); - contents->SetColors(std::move(colors)); - contents->SetStops(std::move(stops)); + contents->SetColors(colors); + contents->SetStops(stops); contents->SetTileMode(tile_mode); contents->SetMatrix(matrix); return contents; @@ -465,7 +466,8 @@ static std::optional ToColorFilterProc( auto blend_mode = ToBlendMode(dl_blend->mode()); auto color = ToColor(dl_blend->color()); return [blend_mode, color](FilterInput::Ref input) { - return ColorFilterContents::MakeBlend(blend_mode, {input}, color); + return ColorFilterContents::MakeBlend(blend_mode, {std::move(input)}, + color); }; } case flutter::DlColorFilterType::kMatrix: { @@ -473,16 +475,17 @@ static std::optional ToColorFilterProc( impeller::FilterContents::ColorMatrix color_matrix; dl_matrix->get_matrix(color_matrix.array); return [color_matrix](FilterInput::Ref input) { - return ColorFilterContents::MakeColorMatrix({input}, color_matrix); + return ColorFilterContents::MakeColorMatrix({std::move(input)}, + color_matrix); }; } case flutter::DlColorFilterType::kSrgbToLinearGamma: return [](FilterInput::Ref input) { - return ColorFilterContents::MakeSrgbToLinearFilter({input}); + return ColorFilterContents::MakeSrgbToLinearFilter({std::move(input)}); }; case flutter::DlColorFilterType::kLinearToSrgbGamma: return [](FilterInput::Ref input) { - return ColorFilterContents::MakeLinearToSrgbFilter({input}); + return ColorFilterContents::MakeLinearToSrgbFilter({std::move(input)}); }; case flutter::DlColorFilterType::kUnknown: FML_LOG(ERROR) << "requested DlColorFilterType::kUnknown"; @@ -569,7 +572,7 @@ static std::optional ToImageFilterProc( auto sigma_y = Sigma(blur->sigma_y()); auto tile_mode = ToTileMode(blur->tile_mode()); - return [sigma_x, sigma_y, tile_mode](FilterInput::Ref input, + return [sigma_x, sigma_y, tile_mode](const FilterInput::Ref& input, const Matrix& effect_transform) { return FilterContents::MakeGaussianBlur( input, sigma_x, sigma_y, FilterContents::BlurStyle::kNormal, @@ -589,8 +592,8 @@ static std::optional ToImageFilterProc( return [radius_x, radius_y](FilterInput::Ref input, const Matrix& effect_transform) { return FilterContents::MakeMorphology( - input, radius_x, radius_y, FilterContents::MorphType::kDilate, - effect_transform); + std::move(input), radius_x, radius_y, + FilterContents::MorphType::kDilate, effect_transform); }; break; } @@ -604,9 +607,9 @@ static std::optional ToImageFilterProc( auto radius_y = Radius(erode->radius_y()); return [radius_x, radius_y](FilterInput::Ref input, const Matrix& effect_transform) { - return FilterContents::MakeMorphology(input, radius_x, radius_y, - FilterContents::MorphType::kErode, - effect_transform); + return FilterContents::MakeMorphology( + std::move(input), radius_x, radius_y, + FilterContents::MorphType::kErode, effect_transform); }; break; } @@ -617,7 +620,7 @@ static std::optional ToImageFilterProc( auto desc = ToSamplerDescriptor(matrix_filter->sampling()); return [matrix, desc](FilterInput::Ref input, const Matrix& effect_transform) { - return FilterContents::MakeMatrixFilter(input, matrix, desc); + return FilterContents::MakeMatrixFilter(std::move(input), matrix, desc); }; break; } @@ -638,7 +641,7 @@ static std::optional ToImageFilterProc( return [outer_filter = outer_proc.value(), inner_filter = inner_proc.value()]( FilterInput::Ref input, const Matrix& effect_transform) { - auto contents = inner_filter(input, effect_transform); + auto contents = inner_filter(std::move(input), effect_transform); contents = outer_filter(FilterInput::Make(contents), effect_transform); return contents; }; @@ -654,7 +657,7 @@ static std::optional ToImageFilterProc( } return [color_filter = color_filter_proc.value()]( FilterInput::Ref input, const Matrix& effect_transform) { - return color_filter(input); + return color_filter(std::move(input)); }; break; } @@ -674,7 +677,7 @@ static std::optional ToImageFilterProc( return [matrix, filter_proc = image_filter_proc.value()]( FilterInput::Ref input, const Matrix& effect_transform) { std::shared_ptr filter = - filter_proc(input, effect_transform); + filter_proc(std::move(input), effect_transform); return FilterContents::MakeLocalMatrixFilter(FilterInput::Make(filter), matrix); }; @@ -814,7 +817,7 @@ void DisplayListDispatcher::clipRect(const SkRect& rect, SkClipOp clip_op, bool is_aa) { auto path = PathBuilder{}.AddRect(ToRect(rect)).TakePath(); - canvas_.ClipPath(std::move(path), ToClipOperation(clip_op)); + canvas_.ClipPath(path, ToClipOperation(clip_op)); } static PathBuilder::RoundingRadii ToRoundingRadii(const SkRRect& rrect) { @@ -942,7 +945,7 @@ void DisplayListDispatcher::drawLine(const SkPoint& p0, const SkPoint& p1) { auto path = PathBuilder{}.AddLine(ToPoint(p0), ToPoint(p1)).TakePath(); Paint paint = paint_; paint.style = Paint::Style::kStroke; - canvas_.DrawPath(std::move(path), std::move(paint)); + canvas_.DrawPath(path, paint); } // |flutter::Dispatcher| @@ -953,13 +956,13 @@ void DisplayListDispatcher::drawRect(const SkRect& rect) { // |flutter::Dispatcher| void DisplayListDispatcher::drawOval(const SkRect& bounds) { auto path = PathBuilder{}.AddOval(ToRect(bounds)).TakePath(); - canvas_.DrawPath(std::move(path), paint_); + canvas_.DrawPath(path, paint_); } // |flutter::Dispatcher| void DisplayListDispatcher::drawCircle(const SkPoint& center, SkScalar radius) { auto path = PathBuilder{}.AddCircle(ToPoint(center), radius).TakePath(); - canvas_.DrawPath(std::move(path), paint_); + canvas_.DrawPath(path, paint_); } // |flutter::Dispatcher| @@ -1010,7 +1013,7 @@ void DisplayListDispatcher::drawPoints(SkCanvas::PointMode mode, for (uint32_t i = 0; i < count; i++) { Point p0 = ToPoint(points[i]); auto path = PathBuilder{}.AddLine(p0, p0).TakePath(); - canvas_.DrawPath(std::move(path), paint); + canvas_.DrawPath(path, paint); } break; case SkCanvas::kLines_PointMode: @@ -1018,7 +1021,7 @@ void DisplayListDispatcher::drawPoints(SkCanvas::PointMode mode, Point p0 = ToPoint(points[i - 1]); Point p1 = ToPoint(points[i]); auto path = PathBuilder{}.AddLine(p0, p1).TakePath(); - canvas_.DrawPath(std::move(path), paint); + canvas_.DrawPath(path, paint); } break; case SkCanvas::kPolygon_PointMode: @@ -1027,7 +1030,7 @@ void DisplayListDispatcher::drawPoints(SkCanvas::PointMode mode, for (uint32_t i = 1; i < count; i++) { Point p1 = ToPoint(points[i]); auto path = PathBuilder{}.AddLine(p0, p1).TakePath(); - canvas_.DrawPath(std::move(path), paint); + canvas_.DrawPath(path, paint); p0 = p1; } } @@ -1227,7 +1230,7 @@ void DisplayListDispatcher::drawShadow(const SkPath& path, canvas_.DrawRRect(ToRect(rrect.rect()), rrect.getSimpleRadii().fX, std::move(paint)); } else { - canvas_.DrawPath(ToPath(path), std::move(paint)); + canvas_.DrawPath(ToPath(path), paint); } canvas_.Restore(); diff --git a/engine/src/flutter/impeller/display_list/nine_patch_converter.cc b/engine/src/flutter/impeller/display_list/nine_patch_converter.cc index 2a9872e0ea..4a4536999a 100644 --- a/engine/src/flutter/impeller/display_list/nine_patch_converter.cc +++ b/engine/src/flutter/impeller/display_list/nine_patch_converter.cc @@ -57,10 +57,10 @@ std::vector NinePatchConverter::InitSlices(double img0, // clang-format on } -void NinePatchConverter::DrawNinePatch(std::shared_ptr image, +void NinePatchConverter::DrawNinePatch(const std::shared_ptr& image, Rect center, Rect dst, - SamplerDescriptor sampler, + const SamplerDescriptor& sampler, Canvas* canvas, Paint* paint) { if (dst.IsEmpty()) { diff --git a/engine/src/flutter/impeller/display_list/nine_patch_converter.h b/engine/src/flutter/impeller/display_list/nine_patch_converter.h index a9250099d4..6795f4dc7f 100644 --- a/engine/src/flutter/impeller/display_list/nine_patch_converter.h +++ b/engine/src/flutter/impeller/display_list/nine_patch_converter.h @@ -22,10 +22,10 @@ class NinePatchConverter { ~NinePatchConverter(); - void DrawNinePatch(std::shared_ptr image, + void DrawNinePatch(const std::shared_ptr& image, Rect center, Rect dst, - SamplerDescriptor sampler, + const SamplerDescriptor& sampler, Canvas* canvas, Paint* paint); diff --git a/engine/src/flutter/impeller/entity/contents/atlas_contents.cc b/engine/src/flutter/impeller/entity/contents/atlas_contents.cc index 5c9d0bec22..b983d29e9c 100644 --- a/engine/src/flutter/impeller/entity/contents/atlas_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/atlas_contents.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include #include "impeller/renderer/formats.h" #include "impeller/renderer/sampler_library.h" @@ -30,15 +31,15 @@ std::shared_ptr AtlasContents::GetTexture() const { } void AtlasContents::SetTransforms(std::vector transforms) { - transforms_ = transforms; + transforms_ = std::move(transforms); } void AtlasContents::SetTextureCoordinates(std::vector texture_coords) { - texture_coords_ = texture_coords; + texture_coords_ = std::move(texture_coords); } void AtlasContents::SetColors(std::vector colors) { - colors_ = colors; + colors_ = std::move(colors); } void AtlasContents::SetAlpha(Scalar alpha) { diff --git a/engine/src/flutter/impeller/entity/contents/clip_contents.cc b/engine/src/flutter/impeller/entity/contents/clip_contents.cc index cb8b56213b..786a5ace3b 100644 --- a/engine/src/flutter/impeller/entity/contents/clip_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/clip_contents.cc @@ -92,7 +92,7 @@ bool ClipContents::Render(const ContentContext& renderer, VertexBufferBuilder{} .AddVertices({{points[0]}, {points[1]}, {points[2]}, {points[3]}}) .CreateVertexBuffer(pass.GetTransientsBuffer()); - cmd.BindVertices(std::move(vertices)); + cmd.BindVertices(vertices); info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()); VS::BindVertInfo(cmd, pass.GetTransientsBuffer().EmplaceUniform(info)); diff --git a/engine/src/flutter/impeller/entity/contents/content_context.cc b/engine/src/flutter/impeller/entity/contents/content_context.cc index f459a22e9a..6e7918f14e 100644 --- a/engine/src/flutter/impeller/entity/contents/content_context.cc +++ b/engine/src/flutter/impeller/entity/contents/content_context.cc @@ -118,7 +118,7 @@ void ContentContextOptions::ApplyToPipelineDescriptor( default: FML_UNREACHABLE(); } - desc.SetColorAttachmentDescriptor(0u, std::move(color0)); + desc.SetColorAttachmentDescriptor(0u, color0); if (desc.GetFrontStencilAttachmentDescriptor().has_value()) { StencilAttachmentDescriptor stencil = @@ -247,7 +247,7 @@ bool ContentContext::IsValid() const { std::shared_ptr ContentContext::MakeSubpass( ISize texture_size, - SubpassCallback subpass_callback) const { + const SubpassCallback& subpass_callback) const { auto context = GetContext(); RenderTarget subpass_target; diff --git a/engine/src/flutter/impeller/entity/contents/content_context.h b/engine/src/flutter/impeller/entity/contents/content_context.h index 2fe847cd88..6a40e6a954 100644 --- a/engine/src/flutter/impeller/entity/contents/content_context.h +++ b/engine/src/flutter/impeller/entity/contents/content_context.h @@ -385,8 +385,9 @@ class ContentContext { /// @brief Creates a new texture of size `texture_size` and calls /// `subpass_callback` with a `RenderPass` for drawing to the texture. - std::shared_ptr MakeSubpass(ISize texture_size, - SubpassCallback subpass_callback) const; + std::shared_ptr MakeSubpass( + ISize texture_size, + const SubpassCallback& subpass_callback) const; private: std::shared_ptr context_; diff --git a/engine/src/flutter/impeller/entity/contents/filters/color_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/color_filter_contents.cc index 10fdcec47b..a4b8db8fc6 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/color_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/color_filter_contents.cc @@ -4,6 +4,8 @@ #include "impeller/entity/contents/filters/color_filter_contents.h" +#include + #include "impeller/base/validation.h" #include "impeller/entity/contents/filters/blend_filter_contents.h" #include "impeller/entity/contents/filters/color_matrix_filter_contents.h" @@ -57,7 +59,7 @@ std::shared_ptr ColorFilterContents::MakeColorMatrix( FilterInput::Ref input, const ColorMatrix& color_matrix) { auto filter = std::make_shared(); - filter->SetInputs({input}); + filter->SetInputs({std::move(input)}); filter->SetMatrix(color_matrix); return filter; } @@ -65,14 +67,14 @@ std::shared_ptr ColorFilterContents::MakeColorMatrix( std::shared_ptr ColorFilterContents::MakeLinearToSrgbFilter(FilterInput::Ref input) { auto filter = std::make_shared(); - filter->SetInputs({input}); + filter->SetInputs({std::move(input)}); return filter; } std::shared_ptr ColorFilterContents::MakeSrgbToLinearFilter(FilterInput::Ref input) { auto filter = std::make_shared(); - filter->SetInputs({input}); + filter->SetInputs({std::move(input)}); return filter; } diff --git a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc index 671101dbcb..b472dcec73 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include "flutter/fml/logging.h" #include "impeller/entity/contents/content_context.h" @@ -38,19 +39,19 @@ std::shared_ptr FilterContents::MakeDirectionalGaussianBlur( Sigma secondary_sigma, const Matrix& effect_transform) { auto blur = std::make_shared(); - blur->SetInputs({input}); + blur->SetInputs({std::move(input)}); blur->SetSigma(sigma); blur->SetDirection(direction); blur->SetBlurStyle(blur_style); blur->SetTileMode(tile_mode); - blur->SetSourceOverride(source_override); + blur->SetSourceOverride(std::move(source_override)); blur->SetSecondarySigma(secondary_sigma); blur->SetEffectTransform(effect_transform); return blur; } std::shared_ptr FilterContents::MakeGaussianBlur( - FilterInput::Ref input, + const FilterInput::Ref& input, Sigma sigma_x, Sigma sigma_y, BlurStyle blur_style, @@ -72,7 +73,7 @@ std::shared_ptr FilterContents::MakeBorderMaskBlur( BlurStyle blur_style, const Matrix& effect_transform) { auto filter = std::make_shared(); - filter->SetInputs({input}); + filter->SetInputs({std::move(input)}); filter->SetSigma(sigma_x, sigma_y); filter->SetBlurStyle(blur_style); filter->SetEffectTransform(effect_transform); @@ -86,7 +87,7 @@ std::shared_ptr FilterContents::MakeDirectionalMorphology( MorphType morph_type, const Matrix& effect_transform) { auto filter = std::make_shared(); - filter->SetInputs({input}); + filter->SetInputs({std::move(input)}); filter->SetRadius(radius); filter->SetDirection(direction); filter->SetMorphType(morph_type); @@ -100,8 +101,8 @@ std::shared_ptr FilterContents::MakeMorphology( Radius radius_y, MorphType morph_type, const Matrix& effect_transform) { - auto x_morphology = MakeDirectionalMorphology(input, radius_x, Point(1, 0), - morph_type, effect_transform); + auto x_morphology = MakeDirectionalMorphology( + std::move(input), radius_x, Point(1, 0), morph_type, effect_transform); auto y_morphology = MakeDirectionalMorphology(FilterInput::Make(x_morphology), radius_y, Point(0, 1), morph_type, effect_transform); @@ -113,7 +114,7 @@ std::shared_ptr FilterContents::MakeMatrixFilter( const Matrix& matrix, const SamplerDescriptor& desc) { auto filter = std::make_shared(); - filter->SetInputs({input}); + filter->SetInputs({std::move(input)}); filter->SetMatrix(matrix); filter->SetSamplerDescriptor(desc); return filter; @@ -123,7 +124,7 @@ std::shared_ptr FilterContents::MakeLocalMatrixFilter( FilterInput::Ref input, const Matrix& matrix) { auto filter = std::make_shared(); - filter->SetInputs({input}); + filter->SetInputs({std::move(input)}); filter->SetMatrix(matrix); return filter; } diff --git a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.h b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.h index bfb25aa7c8..48e12d3389 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/filter_contents.h +++ b/engine/src/flutter/impeller/entity/contents/filters/filter_contents.h @@ -47,7 +47,7 @@ class FilterContents : public Contents { const Matrix& effect_transform = Matrix()); static std::shared_ptr MakeGaussianBlur( - FilterInput::Ref input, + const FilterInput::Ref& input, Sigma sigma_x, Sigma sigma_y, BlurStyle blur_style = BlurStyle::kNormal, diff --git a/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc index 67de116f26..d50ca50642 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc @@ -5,6 +5,7 @@ #include "impeller/entity/contents/filters/gaussian_blur_filter_contents.h" #include +#include #include #include "impeller/base/strings.h" @@ -77,7 +78,7 @@ void DirectionalGaussianBlurFilterContents::SetTileMode( void DirectionalGaussianBlurFilterContents::SetSourceOverride( FilterInput::Ref source_override) { - source_override_ = source_override; + source_override_ = std::move(source_override); } std::optional DirectionalGaussianBlurFilterContents::RenderFilter( diff --git a/engine/src/flutter/impeller/entity/contents/gradient_generator.cc b/engine/src/flutter/impeller/entity/contents/gradient_generator.cc index c66afc3a9d..f5fd4c7034 100644 --- a/engine/src/flutter/impeller/entity/contents/gradient_generator.cc +++ b/engine/src/flutter/impeller/entity/contents/gradient_generator.cc @@ -18,7 +18,7 @@ namespace impeller { std::shared_ptr CreateGradientTexture( const std::vector& colors, const std::vector& stops, - std::shared_ptr context) { + const std::shared_ptr& context) { auto gradient_data = CreateGradientBuffer(colors, stops); if (gradient_data.texture_size == 0) { FML_DLOG(ERROR) << "Invalid gradient data."; diff --git a/engine/src/flutter/impeller/entity/contents/gradient_generator.h b/engine/src/flutter/impeller/entity/contents/gradient_generator.h index ac58948c0a..1110da5683 100644 --- a/engine/src/flutter/impeller/entity/contents/gradient_generator.h +++ b/engine/src/flutter/impeller/entity/contents/gradient_generator.h @@ -25,6 +25,6 @@ class Context; std::shared_ptr CreateGradientTexture( const std::vector& colors, const std::vector& stops, - std::shared_ptr context); + const std::shared_ptr& context); } // namespace impeller diff --git a/engine/src/flutter/impeller/entity/contents/solid_color_contents.cc b/engine/src/flutter/impeller/entity/contents/solid_color_contents.cc index b78f365fea..6b9fe5241f 100644 --- a/engine/src/flutter/impeller/entity/contents/solid_color_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/solid_color_contents.cc @@ -89,10 +89,10 @@ bool SolidColorContents::Render(const ContentContext& renderer, return true; } -std::unique_ptr SolidColorContents::Make(Path path, +std::unique_ptr SolidColorContents::Make(const Path& path, Color color) { auto contents = std::make_unique(); - contents->SetGeometry(Geometry::MakeFillPath(std::move(path))); + contents->SetGeometry(Geometry::MakeFillPath(path)); contents->SetColor(color); return contents; } diff --git a/engine/src/flutter/impeller/entity/contents/solid_color_contents.h b/engine/src/flutter/impeller/entity/contents/solid_color_contents.h index f1c8de81cf..e43e7292a7 100644 --- a/engine/src/flutter/impeller/entity/contents/solid_color_contents.h +++ b/engine/src/flutter/impeller/entity/contents/solid_color_contents.h @@ -26,7 +26,8 @@ class SolidColorContents final : public Contents { ~SolidColorContents() override; - static std::unique_ptr Make(Path path, Color color); + static std::unique_ptr Make(const Path& path, + Color color); void SetGeometry(std::unique_ptr geometry); diff --git a/engine/src/flutter/impeller/entity/contents/text_contents.cc b/engine/src/flutter/impeller/entity/contents/text_contents.cc index 7b24d8dadf..7ccb47c5b9 100644 --- a/engine/src/flutter/impeller/entity/contents/text_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/text_contents.cc @@ -6,6 +6,7 @@ #include #include +#include #include "impeller/entity/contents/content_context.h" #include "impeller/entity/entity.h" @@ -24,8 +25,8 @@ TextContents::TextContents() = default; TextContents::~TextContents() = default; -void TextContents::SetTextFrame(TextFrame frame) { - frame_ = std::move(frame); +void TextContents::SetTextFrame(const TextFrame& frame) { + frame_ = frame; } void TextContents::SetGlyphAtlas(std::shared_ptr atlas) { @@ -38,7 +39,8 @@ std::shared_ptr TextContents::ResolveAtlas( std::shared_ptr context) const { FML_DCHECK(lazy_atlas_); if (lazy_atlas_) { - return lazy_atlas_->CreateOrGetGlyphAtlas(type, atlas_context, context); + return lazy_atlas_->CreateOrGetGlyphAtlas(type, std::move(atlas_context), + std::move(context)); } return nullptr; @@ -57,13 +59,15 @@ std::optional TextContents::GetCoverage(const Entity& entity) const { } template -static bool CommonRender(const ContentContext& renderer, - const Entity& entity, - RenderPass& pass, - const Color& color, - const TextFrame& frame, - std::shared_ptr atlas, - Command& cmd) { +static bool CommonRender( + const ContentContext& renderer, + const Entity& entity, + RenderPass& pass, + const Color& color, + const TextFrame& frame, + std::shared_ptr + atlas, // NOLINT(performance-unnecessary-value-param) + Command& cmd) { using VS = typename TPipeline::VertexShader; using FS = typename TPipeline::FragmentShader; diff --git a/engine/src/flutter/impeller/entity/contents/text_contents.h b/engine/src/flutter/impeller/entity/contents/text_contents.h index 40d96612fc..a0cec70a95 100644 --- a/engine/src/flutter/impeller/entity/contents/text_contents.h +++ b/engine/src/flutter/impeller/entity/contents/text_contents.h @@ -26,7 +26,7 @@ class TextContents final : public Contents { ~TextContents(); - void SetTextFrame(TextFrame frame); + void SetTextFrame(const TextFrame& frame); void SetGlyphAtlas(std::shared_ptr atlas); diff --git a/engine/src/flutter/impeller/entity/contents/texture_contents.cc b/engine/src/flutter/impeller/entity/contents/texture_contents.cc index dd858d0f5c..754396bbd7 100644 --- a/engine/src/flutter/impeller/entity/contents/texture_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/texture_contents.cc @@ -6,6 +6,7 @@ #include #include +#include #include "impeller/entity/contents/content_context.h" #include "impeller/entity/entity.h" @@ -32,11 +33,11 @@ std::shared_ptr TextureContents::MakeRect(Rect destination) { } void TextureContents::SetLabel(std::string label) { - label_ = label; + label_ = std::move(label); } -void TextureContents::SetPath(Path path) { - path_ = std::move(path); +void TextureContents::SetPath(const Path& path) { + path_ = path; is_rect_ = false; } diff --git a/engine/src/flutter/impeller/entity/contents/texture_contents.h b/engine/src/flutter/impeller/entity/contents/texture_contents.h index 8cdf8e767c..9502881cca 100644 --- a/engine/src/flutter/impeller/entity/contents/texture_contents.h +++ b/engine/src/flutter/impeller/entity/contents/texture_contents.h @@ -30,7 +30,7 @@ class TextureContents final : public Contents { void SetLabel(std::string label); - void SetPath(Path path); + void SetPath(const Path& path); void SetTexture(std::shared_ptr texture); diff --git a/engine/src/flutter/impeller/entity/entity_pass.cc b/engine/src/flutter/impeller/entity/entity_pass.cc index 721e14a89f..b83c848083 100644 --- a/engine/src/flutter/impeller/entity/entity_pass.cc +++ b/engine/src/flutter/impeller/entity/entity_pass.cc @@ -5,6 +5,7 @@ #include "impeller/entity/entity_pass.h" #include +#include #include #include "flutter/fml/logging.h" @@ -183,7 +184,7 @@ static RenderTarget CreateRenderTarget(ContentContext& renderer, } bool EntityPass::Render(ContentContext& renderer, - RenderTarget render_target) const { + const RenderTarget& render_target) const { if (reads_from_pass_texture_ > 0) { auto offscreen_target = CreateRenderTarget(renderer, render_target.GetRenderTargetSize(), true); @@ -380,7 +381,7 @@ struct StencilLayer { bool EntityPass::OnRender( ContentContext& renderer, ISize root_pass_size, - RenderTarget render_target, + const RenderTarget& render_target, Point position, Point parent_position, uint32_t pass_depth, @@ -550,7 +551,8 @@ bool EntityPass::OnRender( return true; } -void EntityPass::IterateAllEntities(std::function iterator) { +void EntityPass::IterateAllEntities( + const std::function& iterator) { if (!iterator) { return; } @@ -592,7 +594,7 @@ std::unique_ptr EntityPass::Clone() const { } void EntityPass::SetTransformation(Matrix xformation) { - xformation_ = std::move(xformation); + xformation_ = xformation; } void EntityPass::SetStencilDepth(size_t stencil_depth) { @@ -610,7 +612,7 @@ void EntityPass::SetBackdropFilter(std::optional proc) { "have already been appended to another pass."; } - backdrop_filter_proc_ = proc; + backdrop_filter_proc_ = std::move(proc); } } // namespace impeller diff --git a/engine/src/flutter/impeller/entity/entity_pass.h b/engine/src/flutter/impeller/entity/entity_pass.h index 5a5d3fffdf..cb7c3b5a47 100644 --- a/engine/src/flutter/impeller/entity/entity_pass.h +++ b/engine/src/flutter/impeller/entity/entity_pass.h @@ -49,9 +49,10 @@ class EntityPass { EntityPass* GetSuperpass() const; - bool Render(ContentContext& renderer, RenderTarget render_target) const; + bool Render(ContentContext& renderer, + const RenderTarget& render_target) const; - void IterateAllEntities(std::function iterator); + void IterateAllEntities(const std::function& iterator); void SetTransformation(Matrix xformation); @@ -103,7 +104,7 @@ class EntityPass { bool OnRender( ContentContext& renderer, ISize root_pass_size, - RenderTarget render_target, + const RenderTarget& render_target, Point position, Point parent_position, uint32_t pass_depth, diff --git a/engine/src/flutter/impeller/entity/entity_unittests.cc b/engine/src/flutter/impeller/entity/entity_unittests.cc index 3420166cad..7d57ad8b5e 100644 --- a/engine/src/flutter/impeller/entity/entity_unittests.cc +++ b/engine/src/flutter/impeller/entity/entity_unittests.cc @@ -212,7 +212,7 @@ TEST_P(EntityTest, ThreeStrokesInOnePath) { Entity entity; entity.SetTransformation(Matrix::MakeScale(GetContentScale())); auto contents = std::make_unique(); - contents->SetGeometry(Geometry::MakeStrokePath(std::move(path), 5.0)); + contents->SetGeometry(Geometry::MakeStrokePath(path, 5.0)); contents->SetColor(Color::Red()); entity.SetContents(std::move(contents)); ASSERT_TRUE(OpenPlaygroundHere(entity)); @@ -251,7 +251,7 @@ TEST_P(EntityTest, TriangleInsideASquare) { Entity entity; entity.SetTransformation(Matrix::MakeScale(GetContentScale())); auto contents = std::make_unique(); - contents->SetGeometry(Geometry::MakeStrokePath(std::move(path), 20.0)); + contents->SetGeometry(Geometry::MakeStrokePath(path, 20.0)); contents->SetColor(Color::Red()); entity.SetContents(std::move(contents)); @@ -292,7 +292,7 @@ TEST_P(EntityTest, StrokeCapAndJoinTest) { auto world_matrix = Matrix::MakeScale(GetContentScale()); auto render_path = [width = width, &context, &pass, &world_matrix]( - Path path, Cap cap, Join join) { + const Path& path, Cap cap, Join join) { auto contents = std::make_unique(); contents->SetGeometry( Geometry::MakeStrokePath(path, width, miter_limit, cap, join)); @@ -2061,7 +2061,7 @@ TEST_P(EntityTest, SdfText) { EXPECT_FALSE(lazy_glyph_atlas->HasColor()); auto text_contents = std::make_shared(); - text_contents->SetTextFrame(std::move(frame)); + text_contents->SetTextFrame(frame); text_contents->SetGlyphAtlas(std::move(lazy_glyph_atlas)); text_contents->SetColor(Color(1.0, 0.0, 0.0, 1.0)); Entity entity; diff --git a/engine/src/flutter/impeller/entity/geometry.cc b/engine/src/flutter/impeller/entity/geometry.cc index cab6ab0900..c630ea93be 100644 --- a/engine/src/flutter/impeller/entity/geometry.cc +++ b/engine/src/flutter/impeller/entity/geometry.cc @@ -17,15 +17,16 @@ Geometry::Geometry() = default; Geometry::~Geometry() = default; // static -std::unique_ptr Geometry::MakeVertices(Vertices vertices) { - return std::make_unique(std::move(vertices)); +std::unique_ptr Geometry::MakeVertices( + const Vertices& vertices) { + return std::make_unique(vertices); } -std::unique_ptr Geometry::MakeFillPath(Path path) { - return std::make_unique(std::move(path)); +std::unique_ptr Geometry::MakeFillPath(const Path& path) { + return std::make_unique(path); } -std::unique_ptr Geometry::MakeStrokePath(Path path, +std::unique_ptr Geometry::MakeStrokePath(const Path& path, Scalar stroke_width, Scalar miter_limit, Cap stroke_cap, @@ -48,8 +49,8 @@ std::unique_ptr Geometry::MakeRect(Rect rect) { /////// Vertices Geometry /////// -VerticesGeometry::VerticesGeometry(Vertices vertices) - : vertices_(std::move(vertices)) {} +VerticesGeometry::VerticesGeometry(const Vertices& vertices) + : vertices_(vertices) {} VerticesGeometry::~VerticesGeometry() = default; @@ -194,7 +195,7 @@ std::optional VerticesGeometry::GetCoverage( /////// Path Geometry /////// -FillPathGeometry::FillPathGeometry(Path path) : path_(std::move(path)) {} +FillPathGeometry::FillPathGeometry(const Path& path) : path_(path) {} FillPathGeometry::~FillPathGeometry() = default; @@ -238,12 +239,12 @@ std::optional FillPathGeometry::GetCoverage( ///// Stroke Geometry ////// -StrokePathGeometry::StrokePathGeometry(Path path, +StrokePathGeometry::StrokePathGeometry(const Path& path, Scalar stroke_width, Scalar miter_limit, Cap stroke_cap, Join stroke_join) - : path_(std::move(path)), + : path_(path), stroke_width_(stroke_width), miter_limit_(miter_limit), stroke_cap_(stroke_cap), diff --git a/engine/src/flutter/impeller/entity/geometry.h b/engine/src/flutter/impeller/entity/geometry.h index 799a77c7de..26c2a7b473 100644 --- a/engine/src/flutter/impeller/entity/geometry.h +++ b/engine/src/flutter/impeller/entity/geometry.h @@ -50,12 +50,13 @@ class Geometry { virtual ~Geometry(); - static std::unique_ptr MakeVertices(Vertices vertices); + static std::unique_ptr MakeVertices( + const Vertices& vertices); - static std::unique_ptr MakeFillPath(Path path); + static std::unique_ptr MakeFillPath(const Path& path); static std::unique_ptr MakeStrokePath( - Path path, + const Path& path, Scalar stroke_width = 0.0, Scalar miter_limit = 4.0, Cap stroke_cap = Cap::kButt, @@ -77,7 +78,7 @@ class Geometry { /// @brief A geometry that is created from a vertices object. class VerticesGeometry : public Geometry { public: - explicit VerticesGeometry(Vertices vertices); + explicit VerticesGeometry(const Vertices& vertices); ~VerticesGeometry(); @@ -111,7 +112,7 @@ class VerticesGeometry : public Geometry { /// @brief A geometry that is created from a filled path object. class FillPathGeometry : public Geometry { public: - explicit FillPathGeometry(Path path); + explicit FillPathGeometry(const Path& path); ~FillPathGeometry(); @@ -135,7 +136,7 @@ class FillPathGeometry : public Geometry { /// @brief A geometry that is created from a stroked path object. class StrokePathGeometry : public Geometry { public: - StrokePathGeometry(Path path, + StrokePathGeometry(const Path& path, Scalar stroke_width, Scalar miter_limit, Cap stroke_cap, diff --git a/engine/src/flutter/impeller/geometry/gradient.cc b/engine/src/flutter/impeller/geometry/gradient.cc index fc0f52b957..086d90c2e6 100644 --- a/engine/src/flutter/impeller/geometry/gradient.cc +++ b/engine/src/flutter/impeller/geometry/gradient.cc @@ -40,8 +40,8 @@ GradientData CreateGradientBuffer(const std::vector& colors, // very close together. // TODO(jonahwilliams): this should use a platform specific max texture // size. - texture_size = - std::min((uint32_t)std::round(1.0 / minimum_delta) + 1, 1024u); + texture_size = std::min( + static_cast(std::round(1.0 / minimum_delta)) + 1, 1024u); } std::vector color_stop_channels; color_stop_channels.reserve(texture_size * 4); diff --git a/engine/src/flutter/impeller/playground/backend/gles/playground_impl_gles.cc b/engine/src/flutter/impeller/playground/backend/gles/playground_impl_gles.cc index 8c507f57ce..804672f11a 100644 --- a/engine/src/flutter/impeller/playground/backend/gles/playground_impl_gles.cc +++ b/engine/src/flutter/impeller/playground/backend/gles/playground_impl_gles.cc @@ -142,7 +142,7 @@ std::unique_ptr PlaygroundImplGLES::AcquireSurfaceFrame( ::glfwSwapBuffers(window); return true; }; - return SurfaceGLES::WrapFBO(std::move(context), // + return SurfaceGLES::WrapFBO(context, // swap_callback, // 0u, // PixelFormat::kR8G8B8A8UNormInt, // diff --git a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc index 70168bfe06..331621194f 100644 --- a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc +++ b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc @@ -48,7 +48,8 @@ static ImGui_ImplImpeller_Data* ImGui_ImplImpeller_GetBackendData() { : nullptr; } -bool ImGui_ImplImpeller_Init(std::shared_ptr context) { +bool ImGui_ImplImpeller_Init( + const std::shared_ptr& context) { ImGuiIO& io = ImGui::GetIO(); IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!"); diff --git a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h index 585e8b2f2d..8b60efc31b 100644 --- a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h +++ b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h @@ -16,7 +16,7 @@ class RenderPass; } // namespace impeller IMGUI_IMPL_API bool ImGui_ImplImpeller_Init( - std::shared_ptr context); + const std::shared_ptr& context); IMGUI_IMPL_API void ImGui_ImplImpeller_Shutdown(); diff --git a/engine/src/flutter/impeller/renderer/backend/metal/compute_pipeline_mtl.h b/engine/src/flutter/impeller/renderer/backend/metal/compute_pipeline_mtl.h index 50c33b44f1..9c2efa7488 100644 --- a/engine/src/flutter/impeller/renderer/backend/metal/compute_pipeline_mtl.h +++ b/engine/src/flutter/impeller/renderer/backend/metal/compute_pipeline_mtl.h @@ -29,7 +29,7 @@ class ComputePipelineMTL final bool is_valid_ = false; ComputePipelineMTL(std::weak_ptr library, - ComputePipelineDescriptor desc, + const ComputePipelineDescriptor& desc, id state); // |Pipeline| diff --git a/engine/src/flutter/impeller/renderer/backend/metal/compute_pipeline_mtl.mm b/engine/src/flutter/impeller/renderer/backend/metal/compute_pipeline_mtl.mm index b1d38977c9..912b065b93 100644 --- a/engine/src/flutter/impeller/renderer/backend/metal/compute_pipeline_mtl.mm +++ b/engine/src/flutter/impeller/renderer/backend/metal/compute_pipeline_mtl.mm @@ -7,9 +7,9 @@ namespace impeller { ComputePipelineMTL::ComputePipelineMTL(std::weak_ptr library, - ComputePipelineDescriptor desc, + const ComputePipelineDescriptor& desc, id state) - : Pipeline(std::move(library), std::move(desc)), pipeline_state_(state) { + : Pipeline(std::move(library), desc), pipeline_state_(state) { if (!pipeline_state_) { return; } diff --git a/engine/src/flutter/impeller/renderer/blit_pass.cc b/engine/src/flutter/impeller/renderer/blit_pass.cc index 7e2b0e7843..c11c270c3b 100644 --- a/engine/src/flutter/impeller/renderer/blit_pass.cc +++ b/engine/src/flutter/impeller/renderer/blit_pass.cc @@ -4,6 +4,7 @@ #include "impeller/renderer/blit_pass.h" #include +#include #include "impeller/base/strings.h" #include "impeller/base/validation.h" @@ -72,7 +73,7 @@ bool BlitPass::AddCopy(std::shared_ptr source, OnCopyTextureToTextureCommand(std::move(source), std::move(destination), source_region.value(), destination_origin, - label); + std::move(label)); return true; } @@ -84,7 +85,7 @@ bool BlitPass::GenerateMipmap(std::shared_ptr texture, return false; } - OnGenerateMipmapCommand(std::move(texture), label); + OnGenerateMipmapCommand(std::move(texture), std::move(label)); return true; } diff --git a/engine/src/flutter/impeller/renderer/compute_command.cc b/engine/src/flutter/impeller/renderer/compute_command.cc index 0556b4446e..e2e2812f36 100644 --- a/engine/src/flutter/impeller/renderer/compute_command.cc +++ b/engine/src/flutter/impeller/renderer/compute_command.cc @@ -4,6 +4,8 @@ #include "impeller/renderer/compute_command.h" +#include + #include "impeller/base/validation.h" #include "impeller/renderer/formats.h" #include "impeller/renderer/vertex_descriptor.h" @@ -13,7 +15,7 @@ namespace impeller { bool ComputeCommand::BindResource(ShaderStage stage, const ShaderUniformSlot& slot, const ShaderMetadata& metadata, - BufferView view) { + const BufferView& view) { if (stage != ShaderStage::kCompute) { VALIDATION_LOG << "Use Command for non-compute shader stages."; return false; @@ -26,10 +28,11 @@ bool ComputeCommand::BindResource(ShaderStage stage, return true; } -bool ComputeCommand::BindResource(ShaderStage stage, - const SampledImageSlot& slot, - const ShaderMetadata& metadata, - std::shared_ptr texture) { +bool ComputeCommand::BindResource( + ShaderStage stage, + const SampledImageSlot& slot, + const ShaderMetadata& metadata, + const std::shared_ptr& texture) { if (stage != ShaderStage::kCompute) { VALIDATION_LOG << "Use Command for non-compute shader stages."; return false; @@ -46,10 +49,11 @@ bool ComputeCommand::BindResource(ShaderStage stage, return true; } -bool ComputeCommand::BindResource(ShaderStage stage, - const SampledImageSlot& slot, - const ShaderMetadata& metadata, - std::shared_ptr sampler) { +bool ComputeCommand::BindResource( + ShaderStage stage, + const SampledImageSlot& slot, + const ShaderMetadata& metadata, + const std::shared_ptr& sampler) { if (stage != ShaderStage::kCompute) { VALIDATION_LOG << "Use Command for non-compute shader stages."; return false; @@ -66,11 +70,12 @@ bool ComputeCommand::BindResource(ShaderStage stage, return true; } -bool ComputeCommand::BindResource(ShaderStage stage, - const SampledImageSlot& slot, - const ShaderMetadata& metadata, - std::shared_ptr texture, - std::shared_ptr sampler) { +bool ComputeCommand::BindResource( + ShaderStage stage, + const SampledImageSlot& slot, + const ShaderMetadata& metadata, + const std::shared_ptr& texture, + const std::shared_ptr& sampler) { if (stage != ShaderStage::kCompute) { VALIDATION_LOG << "Use Command for non-compute shader stages."; return false; diff --git a/engine/src/flutter/impeller/renderer/compute_command.h b/engine/src/flutter/impeller/renderer/compute_command.h index 4873b68dbd..54b467a56c 100644 --- a/engine/src/flutter/impeller/renderer/compute_command.h +++ b/engine/src/flutter/impeller/renderer/compute_command.h @@ -57,23 +57,23 @@ struct ComputeCommand { bool BindResource(ShaderStage stage, const ShaderUniformSlot& slot, const ShaderMetadata& metadata, - BufferView view); + const BufferView& view); bool BindResource(ShaderStage stage, const SampledImageSlot& slot, const ShaderMetadata& metadata, - std::shared_ptr texture); + const std::shared_ptr& texture); bool BindResource(ShaderStage stage, const SampledImageSlot& slot, const ShaderMetadata& metadata, - std::shared_ptr sampler); + const std::shared_ptr& sampler); bool BindResource(ShaderStage stage, const SampledImageSlot& slot, const ShaderMetadata& metadata, - std::shared_ptr texture, - std::shared_ptr sampler); + const std::shared_ptr& texture, + const std::shared_ptr& sampler); constexpr operator bool() const { return pipeline && pipeline->IsValid(); } }; diff --git a/engine/src/flutter/impeller/renderer/shader_library.cc b/engine/src/flutter/impeller/renderer/shader_library.cc index 0c5e8dee86..85737fe8dd 100644 --- a/engine/src/flutter/impeller/renderer/shader_library.cc +++ b/engine/src/flutter/impeller/renderer/shader_library.cc @@ -10,10 +10,13 @@ ShaderLibrary::ShaderLibrary() = default; ShaderLibrary::~ShaderLibrary() = default; -void ShaderLibrary::RegisterFunction(std::string name, - ShaderStage stage, - std::shared_ptr code, - RegistrationCallback callback) { +void ShaderLibrary::RegisterFunction( + std::string name, // NOLINT(performance-unnecessary-value-param) + ShaderStage stage, + std::shared_ptr + code, // NOLINT(performance-unnecessary-value-param) + RegistrationCallback + callback) { // NOLINT(performance-unnecessary-value-param) if (callback) { callback(false); } diff --git a/engine/src/flutter/impeller/runtime_stage/runtime_stage_unittests.cc b/engine/src/flutter/impeller/runtime_stage/runtime_stage_unittests.cc index b3aa6208e1..fd454cfe2c 100644 --- a/engine/src/flutter/impeller/runtime_stage/runtime_stage_unittests.cc +++ b/engine/src/flutter/impeller/runtime_stage/runtime_stage_unittests.cc @@ -43,7 +43,7 @@ TEST(RuntimeStageTest, CanRejectInvalidBlob) { // Not meant to be secure. Just reject obviously bad blobs using magic // numbers. ::memset(junk_allocation->GetBuffer(), 127, junk_allocation->GetLength()); - RuntimeStage stage(CreateMappingFromAllocation(std::move(junk_allocation))); + RuntimeStage stage(CreateMappingFromAllocation(junk_allocation)); ASSERT_FALSE(stage.IsValid()); } @@ -237,8 +237,7 @@ TEST_P(RuntimeStageTest, CanCreatePipelineFromRuntimeStage) { desc.SetColorAttachmentDescriptor(0u, color0); desc.SetStencilAttachmentDescriptors(stencil0); desc.SetStencilPixelFormat(PixelFormat::kDefaultStencil); - auto pipeline = - GetContext()->GetPipelineLibrary()->GetPipeline(std::move(desc)).get(); + auto pipeline = GetContext()->GetPipelineLibrary()->GetPipeline(desc).get(); ASSERT_NE(pipeline, nullptr); } diff --git a/engine/src/flutter/impeller/typographer/glyph_atlas.cc b/engine/src/flutter/impeller/typographer/glyph_atlas.cc index bbd7af8a1f..3a6470e974 100644 --- a/engine/src/flutter/impeller/typographer/glyph_atlas.cc +++ b/engine/src/flutter/impeller/typographer/glyph_atlas.cc @@ -4,6 +4,8 @@ #include "impeller/typographer/glyph_atlas.h" +#include + namespace impeller { GlyphAtlasContext::GlyphAtlasContext() @@ -16,7 +18,7 @@ std::shared_ptr GlyphAtlasContext::GetGlyphAtlas() const { } void GlyphAtlasContext::UpdateGlyphAtlas(std::shared_ptr atlas) { - atlas_ = atlas; + atlas_ = std::move(atlas); } GlyphAtlas::GlyphAtlas(Type type) : type_(type) {} diff --git a/engine/src/flutter/impeller/typographer/lazy_glyph_atlas.cc b/engine/src/flutter/impeller/typographer/lazy_glyph_atlas.cc index a6f15e558f..3e415716a5 100644 --- a/engine/src/flutter/impeller/typographer/lazy_glyph_atlas.cc +++ b/engine/src/flutter/impeller/typographer/lazy_glyph_atlas.cc @@ -8,6 +8,8 @@ #include "impeller/typographer/text_render_context.h" #include "lazy_glyph_atlas.h" +#include + namespace impeller { LazyGlyphAtlas::LazyGlyphAtlas() = default; @@ -48,7 +50,8 @@ std::shared_ptr LazyGlyphAtlas::CreateOrGetGlyphAtlas( i++; return &result; }; - auto atlas = text_context->CreateGlyphAtlas(type, atlas_context, iterator); + auto atlas = + text_context->CreateGlyphAtlas(type, std::move(atlas_context), iterator); if (!atlas || !atlas->IsValid()) { VALIDATION_LOG << "Could not create valid atlas."; return nullptr; diff --git a/engine/src/flutter/impeller/typographer/text_render_context.cc b/engine/src/flutter/impeller/typographer/text_render_context.cc index eabb998e18..072e33ab88 100644 --- a/engine/src/flutter/impeller/typographer/text_render_context.cc +++ b/engine/src/flutter/impeller/typographer/text_render_context.cc @@ -4,6 +4,8 @@ #include "impeller/typographer/text_render_context.h" +#include + #include "impeller/typographer/backends/skia/text_render_context_skia.h" namespace impeller { @@ -44,7 +46,7 @@ std::shared_ptr TextRenderContext::CreateGlyphAtlas( } return nullptr; }; - return CreateGlyphAtlas(type, atlas_context, iterator); + return CreateGlyphAtlas(type, std::move(atlas_context), iterator); } } // namespace impeller diff --git a/engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_impeller.cc b/engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_impeller.cc index 1710d1d6e8..49fb3e214d 100644 --- a/engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_impeller.cc +++ b/engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_impeller.cc @@ -5,6 +5,8 @@ #include "flutter/lib/ui/painting/display_list_deferred_image_gpu_impeller.h" #include "display_list_deferred_image_gpu_impeller.h" +#include + namespace flutter { sk_sp DlDeferredImageGPUImpeller::Make( @@ -31,7 +33,7 @@ sk_sp DlDeferredImageGPUImpeller::Make( DlDeferredImageGPUImpeller::DlDeferredImageGPUImpeller( std::shared_ptr wrapper) - : wrapper_(wrapper) {} + : wrapper_(std::move(wrapper)) {} // |DlImage| DlDeferredImageGPUImpeller::~DlDeferredImageGPUImpeller() = default; diff --git a/engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_skia.cc b/engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_skia.cc index 71020b4fdb..14874c2133 100644 --- a/engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_skia.cc +++ b/engine/src/flutter/lib/ui/painting/display_list_deferred_image_gpu_skia.cc @@ -42,14 +42,14 @@ DlDeferredImageGPUSkia::DlDeferredImageGPUSkia( // |DlImage| DlDeferredImageGPUSkia::~DlDeferredImageGPUSkia() { - fml::TaskRunner::RunNowOrPostTask( - raster_task_runner_, [image_wrapper = std::move(image_wrapper_)]() { - if (!image_wrapper) { - return; - } - image_wrapper->Unregister(); - image_wrapper->DeleteTexture(); - }); + fml::TaskRunner::RunNowOrPostTask(raster_task_runner_, + [image_wrapper = image_wrapper_]() { + if (!image_wrapper) { + return; + } + image_wrapper->Unregister(); + image_wrapper->DeleteTexture(); + }); } // |DlImage| diff --git a/engine/src/flutter/lib/ui/window/platform_message_response_dart_port_unittests.cc b/engine/src/flutter/lib/ui/window/platform_message_response_dart_port_unittests.cc index 407e412ece..7dda83049d 100644 --- a/engine/src/flutter/lib/ui/window/platform_message_response_dart_port_unittests.cc +++ b/engine/src/flutter/lib/ui/window/platform_message_response_dart_port_unittests.cc @@ -66,7 +66,7 @@ TEST_F(ShellTest, PlatformMessageResponseDartPort) { message_latch->Wait(); ASSERT_TRUE(did_pass); - DestroyShell(std::move(shell), std::move(task_runners)); + DestroyShell(std::move(shell), task_runners); } } // namespace testing diff --git a/engine/src/flutter/lib/ui/window/platform_message_response_dart_unittests.cc b/engine/src/flutter/lib/ui/window/platform_message_response_dart_unittests.cc index 8c362e75b2..a9a29198bc 100644 --- a/engine/src/flutter/lib/ui/window/platform_message_response_dart_unittests.cc +++ b/engine/src/flutter/lib/ui/window/platform_message_response_dart_unittests.cc @@ -65,7 +65,7 @@ TEST_F(ShellTest, PlatformMessageResponseDart) { message_latch->Wait(); ASSERT_TRUE(did_pass); - DestroyShell(std::move(shell), std::move(task_runners)); + DestroyShell(std::move(shell), task_runners); } } // namespace testing diff --git a/engine/src/flutter/runtime/runtime_controller.cc b/engine/src/flutter/runtime/runtime_controller.cc index dabd4d92cc..933b5abe84 100644 --- a/engine/src/flutter/runtime/runtime_controller.cc +++ b/engine/src/flutter/runtime/runtime_controller.cc @@ -455,7 +455,8 @@ void RuntimeController::LoadDartDeferredLibrary( void RuntimeController::LoadDartDeferredLibraryError( intptr_t loading_unit_id, - const std::string error_message, + const std::string + error_message, // NOLINT(performance-unnecessary-value-param) bool transient) { root_isolate_.lock()->LoadLoadingUnitError(loading_unit_id, error_message, transient); diff --git a/engine/src/flutter/shell/common/platform_view.cc b/engine/src/flutter/shell/common/platform_view.cc index 51c98dc3af..ce2b22009f 100644 --- a/engine/src/flutter/shell/common/platform_view.cc +++ b/engine/src/flutter/shell/common/platform_view.cc @@ -107,8 +107,10 @@ fml::WeakPtr PlatformView::GetWeakPtr() const { return weak_factory_.GetWeakPtr(); } -void PlatformView::UpdateSemantics(SemanticsNodeUpdates update, - CustomAccessibilityActionUpdates actions) {} +void PlatformView::UpdateSemantics( + SemanticsNodeUpdates update, // NOLINT(performance-unnecessary-value-param) + // NOLINTNEXTLINE(performance-unnecessary-value-param) + CustomAccessibilityActionUpdates actions) {} void PlatformView::HandlePlatformMessage( std::unique_ptr message) { @@ -169,9 +171,11 @@ void PlatformView::LoadDartDeferredLibrary( std::unique_ptr snapshot_data, std::unique_ptr snapshot_instructions) {} -void PlatformView::LoadDartDeferredLibraryError(intptr_t loading_unit_id, - const std::string error_message, - bool transient) {} +void PlatformView::LoadDartDeferredLibraryError( + intptr_t loading_unit_id, + const std::string + error_message, // NOLINT(performance-unnecessary-value-param) + bool transient) {} void PlatformView::UpdateAssetResolverByType( std::unique_ptr updated_asset_resolver, diff --git a/engine/src/flutter/shell/common/snapshot_controller_impeller.cc b/engine/src/flutter/shell/common/snapshot_controller_impeller.cc index c25875ab78..6e5d65b747 100644 --- a/engine/src/flutter/shell/common/snapshot_controller_impeller.cc +++ b/engine/src/flutter/shell/common/snapshot_controller_impeller.cc @@ -31,7 +31,7 @@ sk_sp SnapshotControllerImpeller::MakeRasterSnapshot( } sk_sp SnapshotControllerImpeller::DoMakeRasterSnapshot( - sk_sp display_list, + const sk_sp& display_list, SkISize size) { impeller::DisplayListDispatcher dispatcher; display_list->Dispatch(dispatcher); diff --git a/engine/src/flutter/shell/common/snapshot_controller_impeller.h b/engine/src/flutter/shell/common/snapshot_controller_impeller.h index 0f85a961e5..d9f1d632e3 100644 --- a/engine/src/flutter/shell/common/snapshot_controller_impeller.h +++ b/engine/src/flutter/shell/common/snapshot_controller_impeller.h @@ -21,7 +21,7 @@ class SnapshotControllerImpeller : public SnapshotController { sk_sp ConvertToRasterImage(sk_sp image) override; private: - sk_sp DoMakeRasterSnapshot(sk_sp display_list, + sk_sp DoMakeRasterSnapshot(const sk_sp& display_list, SkISize size); FML_DISALLOW_COPY_AND_ASSIGN(SnapshotControllerImpeller); diff --git a/engine/src/flutter/shell/common/snapshot_controller_skia.cc b/engine/src/flutter/shell/common/snapshot_controller_skia.cc index f770e96999..62b665cfb1 100644 --- a/engine/src/flutter/shell/common/snapshot_controller_skia.cc +++ b/engine/src/flutter/shell/common/snapshot_controller_skia.cc @@ -14,7 +14,7 @@ namespace flutter { namespace { sk_sp DrawSnapshot( - sk_sp surface, + const sk_sp& surface, const std::function& draw_callback) { if (surface == nullptr || surface->getCanvas() == nullptr) { return nullptr; diff --git a/engine/src/flutter/shell/gpu/gpu_surface_metal_impeller.h b/engine/src/flutter/shell/gpu/gpu_surface_metal_impeller.h index 0363267cce..3fda202a63 100644 --- a/engine/src/flutter/shell/gpu/gpu_surface_metal_impeller.h +++ b/engine/src/flutter/shell/gpu/gpu_surface_metal_impeller.h @@ -16,7 +16,7 @@ namespace flutter { class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetalImpeller : public Surface { public: GPUSurfaceMetalImpeller(GPUSurfaceMetalDelegate* delegate, - std::shared_ptr context); + const std::shared_ptr& context); // |Surface| ~GPUSurfaceMetalImpeller(); diff --git a/engine/src/flutter/shell/gpu/gpu_surface_metal_impeller.mm b/engine/src/flutter/shell/gpu/gpu_surface_metal_impeller.mm index 307a94a93e..4f6da625d9 100644 --- a/engine/src/flutter/shell/gpu/gpu_surface_metal_impeller.mm +++ b/engine/src/flutter/shell/gpu/gpu_surface_metal_impeller.mm @@ -27,7 +27,7 @@ static std::shared_ptr CreateImpellerRenderer( } GPUSurfaceMetalImpeller::GPUSurfaceMetalImpeller(GPUSurfaceMetalDelegate* delegate, - std::shared_ptr context) + const std::shared_ptr& context) : delegate_(delegate), impeller_renderer_(CreateImpellerRenderer(context)), aiks_context_( diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests_util.cc b/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests_util.cc index d3f6992d81..d6e9236379 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests_util.cc +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests_util.cc @@ -275,9 +275,10 @@ void FilterMutationsByType( void FilterMutationsByType( const FlutterPlatformView* view, FlutterPlatformViewMutationType type, - std::function handler) { + const std::function& + handler) { return FilterMutationsByType(view->mutations, view->mutations_count, type, - std::move(handler)); + handler); } SkMatrix GetTotalMutationTransformationMatrix( diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests_util.h b/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests_util.h index c1a146981b..cbc1892690 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests_util.h +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests_util.h @@ -85,7 +85,8 @@ void FilterMutationsByType( void FilterMutationsByType( const FlutterPlatformView* view, FlutterPlatformViewMutationType type, - std::function handler); + const std::function& + handler); SkMatrix GetTotalMutationTransformationMatrix( const FlutterPlatformViewMutation** mutations, diff --git a/engine/src/flutter/testing/display_list_testing.cc b/engine/src/flutter/testing/display_list_testing.cc index 42507471db..007cd71971 100644 --- a/engine/src/flutter/testing/display_list_testing.cc +++ b/engine/src/flutter/testing/display_list_testing.cc @@ -302,7 +302,7 @@ std::ostream& DisplayListStreamDispatcher::startl() { } template -std::ostream& DisplayListStreamDispatcher::out_array(std::string name, +std::ostream& DisplayListStreamDispatcher::out_array(std::string name, // NOLINT(performance-unnecessary-value-param) int count, const T array[]) { if (array == nullptr || count < 0) { diff --git a/engine/src/flutter/tools/clang_tidy/lib/src/command.dart b/engine/src/flutter/tools/clang_tidy/lib/src/command.dart index f3853bc607..278d6da154 100644 --- a/engine/src/flutter/tools/clang_tidy/lib/src/command.dart +++ b/engine/src/flutter/tools/clang_tidy/lib/src/command.dart @@ -135,7 +135,7 @@ class Command { final List args = [ filePath, if (options.warningsAsErrors != null) - '--warnings-as-errors="${options.warningsAsErrors}"', + '--warnings-as-errors=${options.warningsAsErrors}', if (options.checks != null) options.checks!, if (options.fix) ...[ @@ -149,6 +149,7 @@ class Command { [tidyPath, ...args], workingDirectory: directory, name: 'clang-tidy on $filePath', + printOutput: options.verbose, ); } }