Clang-tidy: made verbose print out commands and fixed quoting problem for warnings as errors (flutter/engine#37015)
This commit is contained in:
@@ -863,7 +863,7 @@ void DisplayListBuilder::drawPoints(SkCanvas::PointMode mode,
|
||||
}
|
||||
void DisplayListBuilder::drawSkVertices(const sk_sp<SkVertices> vertices,
|
||||
SkBlendMode mode) {
|
||||
Push<DrawSkVerticesOp>(0, 1, std::move(vertices), mode);
|
||||
Push<DrawSkVerticesOp>(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<DlImage> image,
|
||||
DlImageSampling sampling,
|
||||
bool render_with_attributes) {
|
||||
render_with_attributes
|
||||
? Push<DrawImageWithAttrOp>(0, 1, std::move(image), point, sampling)
|
||||
: Push<DrawImageOp>(0, 1, std::move(image), point, sampling);
|
||||
? Push<DrawImageWithAttrOp>(0, 1, image, point, sampling)
|
||||
: Push<DrawImageOp>(0, 1, image, point, sampling);
|
||||
CheckLayerOpacityCompatibility(render_with_attributes);
|
||||
}
|
||||
void DisplayListBuilder::drawImage(const sk_sp<DlImage>& image,
|
||||
@@ -914,8 +914,8 @@ void DisplayListBuilder::drawImageRect(const sk_sp<DlImage> image,
|
||||
DlImageSampling sampling,
|
||||
bool render_with_attributes,
|
||||
SkCanvas::SrcRectConstraint constraint) {
|
||||
Push<DrawImageRectOp>(0, 1, std::move(image), src, dst, sampling,
|
||||
render_with_attributes, constraint);
|
||||
Push<DrawImageRectOp>(0, 1, image, src, dst, sampling, render_with_attributes,
|
||||
constraint);
|
||||
CheckLayerOpacityCompatibility(render_with_attributes);
|
||||
}
|
||||
void DisplayListBuilder::drawImageRect(const sk_sp<DlImage>& image,
|
||||
@@ -938,9 +938,8 @@ void DisplayListBuilder::drawImageNine(const sk_sp<DlImage> image,
|
||||
DlFilterMode filter,
|
||||
bool render_with_attributes) {
|
||||
render_with_attributes
|
||||
? Push<DrawImageNineWithAttrOp>(0, 1, std::move(image), center, dst,
|
||||
filter)
|
||||
: Push<DrawImageNineOp>(0, 1, std::move(image), center, dst, filter);
|
||||
? Push<DrawImageNineWithAttrOp>(0, 1, image, center, dst, filter)
|
||||
: Push<DrawImageNineOp>(0, 1, image, center, dst, filter);
|
||||
CheckLayerOpacityCompatibility(render_with_attributes);
|
||||
}
|
||||
void DisplayListBuilder::drawImageNine(const sk_sp<DlImage>& image,
|
||||
@@ -971,9 +970,9 @@ void DisplayListBuilder::drawImageLattice(const sk_sp<DlImage> 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<DrawImageLatticeOp>(
|
||||
bytes, 1, std::move(image), x_div_count, y_div_count, cell_count, src,
|
||||
dst, filter, render_with_attributes);
|
||||
void* pod = this->Push<DrawImageLatticeOp>(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<DlImage> atlas,
|
||||
if (colors != nullptr) {
|
||||
bytes += count * sizeof(DlColor);
|
||||
if (cull_rect != nullptr) {
|
||||
data_ptr = Push<DrawAtlasCulledOp>(bytes, 1, std::move(atlas), count,
|
||||
mode, sampling, true, *cull_rect,
|
||||
render_with_attributes);
|
||||
data_ptr =
|
||||
Push<DrawAtlasCulledOp>(bytes, 1, atlas, count, mode, sampling, true,
|
||||
*cull_rect, render_with_attributes);
|
||||
} else {
|
||||
data_ptr = Push<DrawAtlasOp>(bytes, 1, std::move(atlas), count, mode,
|
||||
sampling, true, render_with_attributes);
|
||||
data_ptr = Push<DrawAtlasOp>(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<DrawAtlasCulledOp>(bytes, 1, std::move(atlas), count,
|
||||
mode, sampling, false, *cull_rect,
|
||||
render_with_attributes);
|
||||
data_ptr =
|
||||
Push<DrawAtlasCulledOp>(bytes, 1, atlas, count, mode, sampling, false,
|
||||
*cull_rect, render_with_attributes);
|
||||
} else {
|
||||
data_ptr = Push<DrawAtlasOp>(bytes, 1, std::move(atlas), count, mode,
|
||||
sampling, false, render_with_attributes);
|
||||
data_ptr = Push<DrawAtlasOp>(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<SkTextBlob> blob,
|
||||
SkScalar x,
|
||||
SkScalar y) {
|
||||
Push<DrawTextBlobOp>(0, 1, std::move(blob), x, y);
|
||||
Push<DrawTextBlobOp>(0, 1, blob, x, y);
|
||||
CheckLayerOpacityCompatibility();
|
||||
}
|
||||
void DisplayListBuilder::drawShadow(const SkPath& path,
|
||||
|
||||
@@ -81,7 +81,8 @@ std::unique_ptr<CompositorContext::ScopedFrame> CompositorContext::AcquireFrame(
|
||||
const SkMatrix& root_surface_transformation,
|
||||
bool instrumentation_enabled,
|
||||
bool surface_supports_readback,
|
||||
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger,
|
||||
fml::RefPtr<fml::RasterThreadMerger>
|
||||
raster_thread_merger, // NOLINT(performance-unnecessary-value-param)
|
||||
DisplayListBuilder* display_list_builder) {
|
||||
return std::make_unique<ScopedFrame>(
|
||||
*this, gr_context, canvas, view_embedder, root_surface_transformation,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
#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> context,
|
||||
bool GenerateMipmap(const std::shared_ptr<Context>& context,
|
||||
std::shared_ptr<Texture> texture,
|
||||
std::string label) {
|
||||
auto buffer = context->CreateCommandBuffer();
|
||||
@@ -85,7 +86,7 @@ bool GenerateMipmap(std::shared_ptr<Context> 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<LinearGradientContents>();
|
||||
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<Image>(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<SkData> OpenFixtureAsSkData(const char* fixture_name) {
|
||||
return data;
|
||||
}
|
||||
|
||||
bool RenderTextInCanvas(std::shared_ptr<Context> context,
|
||||
bool RenderTextInCanvas(const std::shared_ptr<Context>& context,
|
||||
Canvas& canvas,
|
||||
const std::string& text,
|
||||
const std::string& font_fixture,
|
||||
@@ -1129,7 +1130,7 @@ bool RenderTextInCanvas(std::shared_ptr<Context> 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<Image>(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();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#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<EntityPass>();
|
||||
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<ClipContents>();
|
||||
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<ClipRestoreContents>());
|
||||
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> image,
|
||||
void Canvas::DrawImage(const std::shared_ptr<Image>& image,
|
||||
Point offset,
|
||||
Paint paint,
|
||||
const Paint& paint,
|
||||
SamplerDescriptor sampler) {
|
||||
if (!image) {
|
||||
return;
|
||||
@@ -269,13 +267,13 @@ void Canvas::DrawImage(std::shared_ptr<Image> 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> image,
|
||||
void Canvas::DrawImageRect(const std::shared_ptr<Image>& 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> 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<Rect> bounds,
|
||||
std::optional<Paint::ImageFilterProc> backdrop_filter) {
|
||||
void Canvas::SaveLayer(
|
||||
const Paint& paint,
|
||||
std::optional<Rect> bounds,
|
||||
const std::optional<Paint::ImageFilterProc>& 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<TextContents>();
|
||||
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<Image> atlas,
|
||||
void Canvas::DrawAtlas(const std::shared_ptr<Image>& atlas,
|
||||
std::vector<Matrix> transforms,
|
||||
std::vector<Rect> texture_coordinates,
|
||||
std::vector<Color> colors,
|
||||
BlendMode blend_mode,
|
||||
SamplerDescriptor sampler,
|
||||
std::optional<Rect> cull_rect,
|
||||
Paint paint) {
|
||||
const Paint& paint) {
|
||||
if (!atlas) {
|
||||
return;
|
||||
}
|
||||
@@ -421,7 +422,7 @@ void Canvas::DrawAtlas(std::shared_ptr<Image> atlas,
|
||||
entity.SetBlendMode(paint.blend_mode);
|
||||
entity.SetContents(paint.WithFilters(contents, false));
|
||||
|
||||
GetCurrentPass().AddEntity(std::move(entity));
|
||||
GetCurrentPass().AddEntity(entity);
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@@ -35,10 +35,10 @@ class Canvas {
|
||||
|
||||
void Save();
|
||||
|
||||
void SaveLayer(
|
||||
Paint paint,
|
||||
std::optional<Rect> bounds = std::nullopt,
|
||||
std::optional<Paint::ImageFilterProc> backdrop_filter = std::nullopt);
|
||||
void SaveLayer(const Paint& paint,
|
||||
std::optional<Rect> bounds = std::nullopt,
|
||||
const std::optional<Paint::ImageFilterProc>& 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> image,
|
||||
void DrawImage(const std::shared_ptr<Image>& image,
|
||||
Point offset,
|
||||
Paint paint,
|
||||
const Paint& paint,
|
||||
SamplerDescriptor sampler = {});
|
||||
|
||||
void DrawImageRect(std::shared_ptr<Image> image,
|
||||
void DrawImageRect(const std::shared_ptr<Image>& 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<Image> atlas,
|
||||
void DrawAtlas(const std::shared_ptr<Image>& atlas,
|
||||
std::vector<Matrix> transforms,
|
||||
std::vector<Rect> texture_coordinates,
|
||||
std::vector<Color> colors,
|
||||
BlendMode blend_mode,
|
||||
SamplerDescriptor sampler,
|
||||
std::optional<Rect> cull_rect,
|
||||
Paint paint);
|
||||
const Paint& paint);
|
||||
|
||||
Picture EndRecordingAsPicture();
|
||||
|
||||
|
||||
@@ -8,19 +8,18 @@
|
||||
|
||||
namespace impeller {
|
||||
|
||||
std::shared_ptr<Contents> Paint::CreateContentsForEntity(Path path,
|
||||
std::shared_ptr<Contents> Paint::CreateContentsForEntity(const Path& path,
|
||||
bool cover) const {
|
||||
std::unique_ptr<Geometry> 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<Contents> Paint::WithColorFilter(
|
||||
}
|
||||
|
||||
std::shared_ptr<FilterContents> Paint::MaskBlurDescriptor::CreateMaskBlur(
|
||||
FilterInput::Ref input,
|
||||
const FilterInput::Ref& input,
|
||||
bool is_solid_color,
|
||||
const Matrix& effect_transform) const {
|
||||
if (is_solid_color) {
|
||||
|
||||
@@ -41,7 +41,7 @@ struct Paint {
|
||||
Sigma sigma;
|
||||
|
||||
std::shared_ptr<FilterContents> 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<Contents> input,
|
||||
const Matrix& effect_transform = Matrix()) const;
|
||||
|
||||
std::shared_ptr<Contents> CreateContentsForEntity(Path path = {},
|
||||
std::shared_ptr<Contents> CreateContentsForEntity(const Path& path = {},
|
||||
bool cover = false) const;
|
||||
|
||||
std::shared_ptr<Contents> CreateContentsForGeometry(
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace impeller {
|
||||
|
||||
PaintPassDelegate::PaintPassDelegate(Paint paint, std::optional<Rect> coverage)
|
||||
: paint_(std::move(paint)), coverage_(std::move(coverage)) {}
|
||||
: paint_(std::move(paint)), coverage_(coverage) {}
|
||||
|
||||
// |EntityPassDelgate|
|
||||
PaintPassDelegate::~PaintPassDelegate() = default;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "impeller/base/validation.h"
|
||||
#include "impeller/blobcat/blob_flatbuffers.h"
|
||||
@@ -74,16 +75,16 @@ std::shared_ptr<fml::Mapping> 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<bool(BlobShaderType type,
|
||||
const std::string& name,
|
||||
const std::shared_ptr<fml::Mapping>& mapping)> callback)
|
||||
const {
|
||||
const std::function<bool(BlobShaderType type,
|
||||
const std::string& name,
|
||||
const std::shared_ptr<fml::Mapping>& mapping)>&
|
||||
callback) const {
|
||||
if (!IsValid() || !callback) {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
@@ -31,9 +31,10 @@ class BlobLibrary {
|
||||
std::string name) const;
|
||||
|
||||
size_t IterateAllBlobs(
|
||||
std::function<bool(BlobShaderType type,
|
||||
const std::string& name,
|
||||
const std::shared_ptr<fml::Mapping>& mapping)>) const;
|
||||
const std::function<bool(BlobShaderType type,
|
||||
const std::string& name,
|
||||
const std::shared_ptr<fml::Mapping>& mapping)>&)
|
||||
const;
|
||||
|
||||
private:
|
||||
struct BlobKey {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#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<LinearGradientContents>();
|
||||
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<RadialGradientContents>();
|
||||
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<SweepGradientContents>();
|
||||
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<Paint::ColorFilterProc> 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<Paint::ColorFilterProc> 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<Paint::ImageFilterProc> 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<Paint::ImageFilterProc> 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<Paint::ImageFilterProc> 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<Paint::ImageFilterProc> 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<Paint::ImageFilterProc> 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<Paint::ImageFilterProc> 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<Paint::ImageFilterProc> ToImageFilterProc(
|
||||
return [matrix, filter_proc = image_filter_proc.value()](
|
||||
FilterInput::Ref input, const Matrix& effect_transform) {
|
||||
std::shared_ptr<FilterContents> 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();
|
||||
|
||||
@@ -57,10 +57,10 @@ std::vector<double> NinePatchConverter::InitSlices(double img0,
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void NinePatchConverter::DrawNinePatch(std::shared_ptr<Image> image,
|
||||
void NinePatchConverter::DrawNinePatch(const std::shared_ptr<Image>& image,
|
||||
Rect center,
|
||||
Rect dst,
|
||||
SamplerDescriptor sampler,
|
||||
const SamplerDescriptor& sampler,
|
||||
Canvas* canvas,
|
||||
Paint* paint) {
|
||||
if (dst.IsEmpty()) {
|
||||
|
||||
@@ -22,10 +22,10 @@ class NinePatchConverter {
|
||||
|
||||
~NinePatchConverter();
|
||||
|
||||
void DrawNinePatch(std::shared_ptr<Image> image,
|
||||
void DrawNinePatch(const std::shared_ptr<Image>& image,
|
||||
Rect center,
|
||||
Rect dst,
|
||||
SamplerDescriptor sampler,
|
||||
const SamplerDescriptor& sampler,
|
||||
Canvas* canvas,
|
||||
Paint* paint);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include "impeller/renderer/formats.h"
|
||||
#include "impeller/renderer/sampler_library.h"
|
||||
@@ -30,15 +31,15 @@ std::shared_ptr<Texture> AtlasContents::GetTexture() const {
|
||||
}
|
||||
|
||||
void AtlasContents::SetTransforms(std::vector<Matrix> transforms) {
|
||||
transforms_ = transforms;
|
||||
transforms_ = std::move(transforms);
|
||||
}
|
||||
|
||||
void AtlasContents::SetTextureCoordinates(std::vector<Rect> texture_coords) {
|
||||
texture_coords_ = texture_coords;
|
||||
texture_coords_ = std::move(texture_coords);
|
||||
}
|
||||
|
||||
void AtlasContents::SetColors(std::vector<Color> colors) {
|
||||
colors_ = colors;
|
||||
colors_ = std::move(colors);
|
||||
}
|
||||
|
||||
void AtlasContents::SetAlpha(Scalar alpha) {
|
||||
|
||||
@@ -92,7 +92,7 @@ bool ClipContents::Render(const ContentContext& renderer,
|
||||
VertexBufferBuilder<VS::PerVertexData>{}
|
||||
.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));
|
||||
|
||||
@@ -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<Texture> ContentContext::MakeSubpass(
|
||||
ISize texture_size,
|
||||
SubpassCallback subpass_callback) const {
|
||||
const SubpassCallback& subpass_callback) const {
|
||||
auto context = GetContext();
|
||||
|
||||
RenderTarget subpass_target;
|
||||
|
||||
@@ -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<Texture> MakeSubpass(ISize texture_size,
|
||||
SubpassCallback subpass_callback) const;
|
||||
std::shared_ptr<Texture> MakeSubpass(
|
||||
ISize texture_size,
|
||||
const SubpassCallback& subpass_callback) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<Context> context_;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "impeller/entity/contents/filters/color_filter_contents.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#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> ColorFilterContents::MakeColorMatrix(
|
||||
FilterInput::Ref input,
|
||||
const ColorMatrix& color_matrix) {
|
||||
auto filter = std::make_shared<ColorMatrixFilterContents>();
|
||||
filter->SetInputs({input});
|
||||
filter->SetInputs({std::move(input)});
|
||||
filter->SetMatrix(color_matrix);
|
||||
return filter;
|
||||
}
|
||||
@@ -65,14 +67,14 @@ std::shared_ptr<ColorFilterContents> ColorFilterContents::MakeColorMatrix(
|
||||
std::shared_ptr<ColorFilterContents>
|
||||
ColorFilterContents::MakeLinearToSrgbFilter(FilterInput::Ref input) {
|
||||
auto filter = std::make_shared<LinearToSrgbFilterContents>();
|
||||
filter->SetInputs({input});
|
||||
filter->SetInputs({std::move(input)});
|
||||
return filter;
|
||||
}
|
||||
|
||||
std::shared_ptr<ColorFilterContents>
|
||||
ColorFilterContents::MakeSrgbToLinearFilter(FilterInput::Ref input) {
|
||||
auto filter = std::make_shared<SrgbToLinearFilterContents>();
|
||||
filter->SetInputs({input});
|
||||
filter->SetInputs({std::move(input)});
|
||||
return filter;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "impeller/entity/contents/content_context.h"
|
||||
@@ -38,19 +39,19 @@ std::shared_ptr<FilterContents> FilterContents::MakeDirectionalGaussianBlur(
|
||||
Sigma secondary_sigma,
|
||||
const Matrix& effect_transform) {
|
||||
auto blur = std::make_shared<DirectionalGaussianBlurFilterContents>();
|
||||
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> 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> FilterContents::MakeBorderMaskBlur(
|
||||
BlurStyle blur_style,
|
||||
const Matrix& effect_transform) {
|
||||
auto filter = std::make_shared<BorderMaskBlurFilterContents>();
|
||||
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> FilterContents::MakeDirectionalMorphology(
|
||||
MorphType morph_type,
|
||||
const Matrix& effect_transform) {
|
||||
auto filter = std::make_shared<DirectionalMorphologyFilterContents>();
|
||||
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> 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> FilterContents::MakeMatrixFilter(
|
||||
const Matrix& matrix,
|
||||
const SamplerDescriptor& desc) {
|
||||
auto filter = std::make_shared<MatrixFilterContents>();
|
||||
filter->SetInputs({input});
|
||||
filter->SetInputs({std::move(input)});
|
||||
filter->SetMatrix(matrix);
|
||||
filter->SetSamplerDescriptor(desc);
|
||||
return filter;
|
||||
@@ -123,7 +124,7 @@ std::shared_ptr<FilterContents> FilterContents::MakeLocalMatrixFilter(
|
||||
FilterInput::Ref input,
|
||||
const Matrix& matrix) {
|
||||
auto filter = std::make_shared<LocalMatrixFilterContents>();
|
||||
filter->SetInputs({input});
|
||||
filter->SetInputs({std::move(input)});
|
||||
filter->SetMatrix(matrix);
|
||||
return filter;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class FilterContents : public Contents {
|
||||
const Matrix& effect_transform = Matrix());
|
||||
|
||||
static std::shared_ptr<FilterContents> MakeGaussianBlur(
|
||||
FilterInput::Ref input,
|
||||
const FilterInput::Ref& input,
|
||||
Sigma sigma_x,
|
||||
Sigma sigma_y,
|
||||
BlurStyle blur_style = BlurStyle::kNormal,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "impeller/entity/contents/filters/gaussian_blur_filter_contents.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
#include <valarray>
|
||||
|
||||
#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<Snapshot> DirectionalGaussianBlurFilterContents::RenderFilter(
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace impeller {
|
||||
std::shared_ptr<Texture> CreateGradientTexture(
|
||||
const std::vector<Color>& colors,
|
||||
const std::vector<Scalar>& stops,
|
||||
std::shared_ptr<impeller::Context> context) {
|
||||
const std::shared_ptr<impeller::Context>& context) {
|
||||
auto gradient_data = CreateGradientBuffer(colors, stops);
|
||||
if (gradient_data.texture_size == 0) {
|
||||
FML_DLOG(ERROR) << "Invalid gradient data.";
|
||||
|
||||
@@ -25,6 +25,6 @@ class Context;
|
||||
std::shared_ptr<Texture> CreateGradientTexture(
|
||||
const std::vector<Color>& colors,
|
||||
const std::vector<Scalar>& stops,
|
||||
std::shared_ptr<impeller::Context> context);
|
||||
const std::shared_ptr<impeller::Context>& context);
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@@ -89,10 +89,10 @@ bool SolidColorContents::Render(const ContentContext& renderer,
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<SolidColorContents> SolidColorContents::Make(Path path,
|
||||
std::unique_ptr<SolidColorContents> SolidColorContents::Make(const Path& path,
|
||||
Color color) {
|
||||
auto contents = std::make_unique<SolidColorContents>();
|
||||
contents->SetGeometry(Geometry::MakeFillPath(std::move(path)));
|
||||
contents->SetGeometry(Geometry::MakeFillPath(path));
|
||||
contents->SetColor(color);
|
||||
return contents;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class SolidColorContents final : public Contents {
|
||||
|
||||
~SolidColorContents() override;
|
||||
|
||||
static std::unique_ptr<SolidColorContents> Make(Path path, Color color);
|
||||
static std::unique_ptr<SolidColorContents> Make(const Path& path,
|
||||
Color color);
|
||||
|
||||
void SetGeometry(std::unique_ptr<Geometry> geometry);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <optional>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#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<LazyGlyphAtlas> atlas) {
|
||||
@@ -38,7 +39,8 @@ std::shared_ptr<GlyphAtlas> TextContents::ResolveAtlas(
|
||||
std::shared_ptr<Context> 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<Rect> TextContents::GetCoverage(const Entity& entity) const {
|
||||
}
|
||||
|
||||
template <class TPipeline>
|
||||
static bool CommonRender(const ContentContext& renderer,
|
||||
const Entity& entity,
|
||||
RenderPass& pass,
|
||||
const Color& color,
|
||||
const TextFrame& frame,
|
||||
std::shared_ptr<GlyphAtlas> atlas,
|
||||
Command& cmd) {
|
||||
static bool CommonRender(
|
||||
const ContentContext& renderer,
|
||||
const Entity& entity,
|
||||
RenderPass& pass,
|
||||
const Color& color,
|
||||
const TextFrame& frame,
|
||||
std::shared_ptr<GlyphAtlas>
|
||||
atlas, // NOLINT(performance-unnecessary-value-param)
|
||||
Command& cmd) {
|
||||
using VS = typename TPipeline::VertexShader;
|
||||
using FS = typename TPipeline::FragmentShader;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class TextContents final : public Contents {
|
||||
|
||||
~TextContents();
|
||||
|
||||
void SetTextFrame(TextFrame frame);
|
||||
void SetTextFrame(const TextFrame& frame);
|
||||
|
||||
void SetGlyphAtlas(std::shared_ptr<LazyGlyphAtlas> atlas);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include "impeller/entity/contents/content_context.h"
|
||||
#include "impeller/entity/entity.h"
|
||||
@@ -32,11 +33,11 @@ std::shared_ptr<TextureContents> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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> texture);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "impeller/entity/entity_pass.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
#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<bool(Entity&)> iterator) {
|
||||
void EntityPass::IterateAllEntities(
|
||||
const std::function<bool(Entity&)>& iterator) {
|
||||
if (!iterator) {
|
||||
return;
|
||||
}
|
||||
@@ -592,7 +594,7 @@ std::unique_ptr<EntityPass> 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<BackdropFilterProc> proc) {
|
||||
"have already been appended to another pass.";
|
||||
}
|
||||
|
||||
backdrop_filter_proc_ = proc;
|
||||
backdrop_filter_proc_ = std::move(proc);
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@@ -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<bool(Entity&)> iterator);
|
||||
void IterateAllEntities(const std::function<bool(Entity&)>& 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,
|
||||
|
||||
@@ -212,7 +212,7 @@ TEST_P(EntityTest, ThreeStrokesInOnePath) {
|
||||
Entity entity;
|
||||
entity.SetTransformation(Matrix::MakeScale(GetContentScale()));
|
||||
auto contents = std::make_unique<SolidColorContents>();
|
||||
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<SolidColorContents>();
|
||||
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<SolidColorContents>();
|
||||
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<TextContents>();
|
||||
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;
|
||||
|
||||
@@ -17,15 +17,16 @@ Geometry::Geometry() = default;
|
||||
Geometry::~Geometry() = default;
|
||||
|
||||
// static
|
||||
std::unique_ptr<VerticesGeometry> Geometry::MakeVertices(Vertices vertices) {
|
||||
return std::make_unique<VerticesGeometry>(std::move(vertices));
|
||||
std::unique_ptr<VerticesGeometry> Geometry::MakeVertices(
|
||||
const Vertices& vertices) {
|
||||
return std::make_unique<VerticesGeometry>(vertices);
|
||||
}
|
||||
|
||||
std::unique_ptr<Geometry> Geometry::MakeFillPath(Path path) {
|
||||
return std::make_unique<FillPathGeometry>(std::move(path));
|
||||
std::unique_ptr<Geometry> Geometry::MakeFillPath(const Path& path) {
|
||||
return std::make_unique<FillPathGeometry>(path);
|
||||
}
|
||||
|
||||
std::unique_ptr<Geometry> Geometry::MakeStrokePath(Path path,
|
||||
std::unique_ptr<Geometry> Geometry::MakeStrokePath(const Path& path,
|
||||
Scalar stroke_width,
|
||||
Scalar miter_limit,
|
||||
Cap stroke_cap,
|
||||
@@ -48,8 +49,8 @@ std::unique_ptr<Geometry> 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<Rect> 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<Rect> 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),
|
||||
|
||||
@@ -50,12 +50,13 @@ class Geometry {
|
||||
|
||||
virtual ~Geometry();
|
||||
|
||||
static std::unique_ptr<VerticesGeometry> MakeVertices(Vertices vertices);
|
||||
static std::unique_ptr<VerticesGeometry> MakeVertices(
|
||||
const Vertices& vertices);
|
||||
|
||||
static std::unique_ptr<Geometry> MakeFillPath(Path path);
|
||||
static std::unique_ptr<Geometry> MakeFillPath(const Path& path);
|
||||
|
||||
static std::unique_ptr<Geometry> 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,
|
||||
|
||||
@@ -40,8 +40,8 @@ GradientData CreateGradientBuffer(const std::vector<Color>& 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<uint32_t>(std::round(1.0 / minimum_delta)) + 1, 1024u);
|
||||
}
|
||||
std::vector<uint8_t> color_stop_channels;
|
||||
color_stop_channels.reserve(texture_size * 4);
|
||||
|
||||
@@ -142,7 +142,7 @@ std::unique_ptr<Surface> PlaygroundImplGLES::AcquireSurfaceFrame(
|
||||
::glfwSwapBuffers(window);
|
||||
return true;
|
||||
};
|
||||
return SurfaceGLES::WrapFBO(std::move(context), //
|
||||
return SurfaceGLES::WrapFBO(context, //
|
||||
swap_callback, //
|
||||
0u, //
|
||||
PixelFormat::kR8G8B8A8UNormInt, //
|
||||
|
||||
@@ -48,7 +48,8 @@ static ImGui_ImplImpeller_Data* ImGui_ImplImpeller_GetBackendData() {
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
bool ImGui_ImplImpeller_Init(std::shared_ptr<impeller::Context> context) {
|
||||
bool ImGui_ImplImpeller_Init(
|
||||
const std::shared_ptr<impeller::Context>& context) {
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(io.BackendRendererUserData == nullptr &&
|
||||
"Already initialized a renderer backend!");
|
||||
|
||||
@@ -16,7 +16,7 @@ class RenderPass;
|
||||
} // namespace impeller
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplImpeller_Init(
|
||||
std::shared_ptr<impeller::Context> context);
|
||||
const std::shared_ptr<impeller::Context>& context);
|
||||
|
||||
IMGUI_IMPL_API void ImGui_ImplImpeller_Shutdown();
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class ComputePipelineMTL final
|
||||
bool is_valid_ = false;
|
||||
|
||||
ComputePipelineMTL(std::weak_ptr<PipelineLibrary> library,
|
||||
ComputePipelineDescriptor desc,
|
||||
const ComputePipelineDescriptor& desc,
|
||||
id<MTLComputePipelineState> state);
|
||||
|
||||
// |Pipeline|
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
namespace impeller {
|
||||
|
||||
ComputePipelineMTL::ComputePipelineMTL(std::weak_ptr<PipelineLibrary> library,
|
||||
ComputePipelineDescriptor desc,
|
||||
const ComputePipelineDescriptor& desc,
|
||||
id<MTLComputePipelineState> state)
|
||||
: Pipeline(std::move(library), std::move(desc)), pipeline_state_(state) {
|
||||
: Pipeline(std::move(library), desc), pipeline_state_(state) {
|
||||
if (!pipeline_state_) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "impeller/renderer/blit_pass.h"
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "impeller/base/strings.h"
|
||||
#include "impeller/base/validation.h"
|
||||
@@ -72,7 +73,7 @@ bool BlitPass::AddCopy(std::shared_ptr<Texture> 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> texture,
|
||||
return false;
|
||||
}
|
||||
|
||||
OnGenerateMipmapCommand(std::move(texture), label);
|
||||
OnGenerateMipmapCommand(std::move(texture), std::move(label));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "impeller/renderer/compute_command.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#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<const Texture> texture) {
|
||||
bool ComputeCommand::BindResource(
|
||||
ShaderStage stage,
|
||||
const SampledImageSlot& slot,
|
||||
const ShaderMetadata& metadata,
|
||||
const std::shared_ptr<const Texture>& 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<const Sampler> sampler) {
|
||||
bool ComputeCommand::BindResource(
|
||||
ShaderStage stage,
|
||||
const SampledImageSlot& slot,
|
||||
const ShaderMetadata& metadata,
|
||||
const std::shared_ptr<const Sampler>& 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<const Texture> texture,
|
||||
std::shared_ptr<const Sampler> sampler) {
|
||||
bool ComputeCommand::BindResource(
|
||||
ShaderStage stage,
|
||||
const SampledImageSlot& slot,
|
||||
const ShaderMetadata& metadata,
|
||||
const std::shared_ptr<const Texture>& texture,
|
||||
const std::shared_ptr<const Sampler>& sampler) {
|
||||
if (stage != ShaderStage::kCompute) {
|
||||
VALIDATION_LOG << "Use Command for non-compute shader stages.";
|
||||
return false;
|
||||
|
||||
@@ -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<const Texture> texture);
|
||||
const std::shared_ptr<const Texture>& texture);
|
||||
|
||||
bool BindResource(ShaderStage stage,
|
||||
const SampledImageSlot& slot,
|
||||
const ShaderMetadata& metadata,
|
||||
std::shared_ptr<const Sampler> sampler);
|
||||
const std::shared_ptr<const Sampler>& sampler);
|
||||
|
||||
bool BindResource(ShaderStage stage,
|
||||
const SampledImageSlot& slot,
|
||||
const ShaderMetadata& metadata,
|
||||
std::shared_ptr<const Texture> texture,
|
||||
std::shared_ptr<const Sampler> sampler);
|
||||
const std::shared_ptr<const Texture>& texture,
|
||||
const std::shared_ptr<const Sampler>& sampler);
|
||||
|
||||
constexpr operator bool() const { return pipeline && pipeline->IsValid(); }
|
||||
};
|
||||
|
||||
@@ -10,10 +10,13 @@ ShaderLibrary::ShaderLibrary() = default;
|
||||
|
||||
ShaderLibrary::~ShaderLibrary() = default;
|
||||
|
||||
void ShaderLibrary::RegisterFunction(std::string name,
|
||||
ShaderStage stage,
|
||||
std::shared_ptr<fml::Mapping> code,
|
||||
RegistrationCallback callback) {
|
||||
void ShaderLibrary::RegisterFunction(
|
||||
std::string name, // NOLINT(performance-unnecessary-value-param)
|
||||
ShaderStage stage,
|
||||
std::shared_ptr<fml::Mapping>
|
||||
code, // NOLINT(performance-unnecessary-value-param)
|
||||
RegistrationCallback
|
||||
callback) { // NOLINT(performance-unnecessary-value-param)
|
||||
if (callback) {
|
||||
callback(false);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "impeller/typographer/glyph_atlas.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace impeller {
|
||||
|
||||
GlyphAtlasContext::GlyphAtlasContext()
|
||||
@@ -16,7 +18,7 @@ std::shared_ptr<GlyphAtlas> GlyphAtlasContext::GetGlyphAtlas() const {
|
||||
}
|
||||
|
||||
void GlyphAtlasContext::UpdateGlyphAtlas(std::shared_ptr<GlyphAtlas> atlas) {
|
||||
atlas_ = atlas;
|
||||
atlas_ = std::move(atlas);
|
||||
}
|
||||
|
||||
GlyphAtlas::GlyphAtlas(Type type) : type_(type) {}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "impeller/typographer/text_render_context.h"
|
||||
#include "lazy_glyph_atlas.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace impeller {
|
||||
|
||||
LazyGlyphAtlas::LazyGlyphAtlas() = default;
|
||||
@@ -48,7 +50,8 @@ std::shared_ptr<GlyphAtlas> 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;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "impeller/typographer/text_render_context.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "impeller/typographer/backends/skia/text_render_context_skia.h"
|
||||
|
||||
namespace impeller {
|
||||
@@ -44,7 +46,7 @@ std::shared_ptr<GlyphAtlas> TextRenderContext::CreateGlyphAtlas(
|
||||
}
|
||||
return nullptr;
|
||||
};
|
||||
return CreateGlyphAtlas(type, atlas_context, iterator);
|
||||
return CreateGlyphAtlas(type, std::move(atlas_context), iterator);
|
||||
}
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
@@ -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 <utility>
|
||||
|
||||
namespace flutter {
|
||||
|
||||
sk_sp<DlDeferredImageGPUImpeller> DlDeferredImageGPUImpeller::Make(
|
||||
@@ -31,7 +33,7 @@ sk_sp<DlDeferredImageGPUImpeller> DlDeferredImageGPUImpeller::Make(
|
||||
|
||||
DlDeferredImageGPUImpeller::DlDeferredImageGPUImpeller(
|
||||
std::shared_ptr<ImageWrapper> wrapper)
|
||||
: wrapper_(wrapper) {}
|
||||
: wrapper_(std::move(wrapper)) {}
|
||||
|
||||
// |DlImage|
|
||||
DlDeferredImageGPUImpeller::~DlDeferredImageGPUImpeller() = default;
|
||||
|
||||
@@ -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|
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -107,8 +107,10 @@ fml::WeakPtr<PlatformView> 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<PlatformMessage> message) {
|
||||
@@ -169,9 +171,11 @@ void PlatformView::LoadDartDeferredLibrary(
|
||||
std::unique_ptr<const fml::Mapping> snapshot_data,
|
||||
std::unique_ptr<const fml::Mapping> 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<AssetResolver> updated_asset_resolver,
|
||||
|
||||
@@ -31,7 +31,7 @@ sk_sp<DlImage> SnapshotControllerImpeller::MakeRasterSnapshot(
|
||||
}
|
||||
|
||||
sk_sp<DlImage> SnapshotControllerImpeller::DoMakeRasterSnapshot(
|
||||
sk_sp<DisplayList> display_list,
|
||||
const sk_sp<DisplayList>& display_list,
|
||||
SkISize size) {
|
||||
impeller::DisplayListDispatcher dispatcher;
|
||||
display_list->Dispatch(dispatcher);
|
||||
|
||||
@@ -21,7 +21,7 @@ class SnapshotControllerImpeller : public SnapshotController {
|
||||
sk_sp<SkImage> ConvertToRasterImage(sk_sp<SkImage> image) override;
|
||||
|
||||
private:
|
||||
sk_sp<DlImage> DoMakeRasterSnapshot(sk_sp<DisplayList> display_list,
|
||||
sk_sp<DlImage> DoMakeRasterSnapshot(const sk_sp<DisplayList>& display_list,
|
||||
SkISize size);
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(SnapshotControllerImpeller);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace flutter {
|
||||
|
||||
namespace {
|
||||
sk_sp<SkImage> DrawSnapshot(
|
||||
sk_sp<SkSurface> surface,
|
||||
const sk_sp<SkSurface>& surface,
|
||||
const std::function<void(SkCanvas*)>& draw_callback) {
|
||||
if (surface == nullptr || surface->getCanvas() == nullptr) {
|
||||
return nullptr;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace flutter {
|
||||
class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetalImpeller : public Surface {
|
||||
public:
|
||||
GPUSurfaceMetalImpeller(GPUSurfaceMetalDelegate* delegate,
|
||||
std::shared_ptr<impeller::Context> context);
|
||||
const std::shared_ptr<impeller::Context>& context);
|
||||
|
||||
// |Surface|
|
||||
~GPUSurfaceMetalImpeller();
|
||||
|
||||
@@ -27,7 +27,7 @@ static std::shared_ptr<impeller::Renderer> CreateImpellerRenderer(
|
||||
}
|
||||
|
||||
GPUSurfaceMetalImpeller::GPUSurfaceMetalImpeller(GPUSurfaceMetalDelegate* delegate,
|
||||
std::shared_ptr<impeller::Context> context)
|
||||
const std::shared_ptr<impeller::Context>& context)
|
||||
: delegate_(delegate),
|
||||
impeller_renderer_(CreateImpellerRenderer(context)),
|
||||
aiks_context_(
|
||||
|
||||
@@ -275,9 +275,10 @@ void FilterMutationsByType(
|
||||
void FilterMutationsByType(
|
||||
const FlutterPlatformView* view,
|
||||
FlutterPlatformViewMutationType type,
|
||||
std::function<void(const FlutterPlatformViewMutation& mutation)> handler) {
|
||||
const std::function<void(const FlutterPlatformViewMutation& mutation)>&
|
||||
handler) {
|
||||
return FilterMutationsByType(view->mutations, view->mutations_count, type,
|
||||
std::move(handler));
|
||||
handler);
|
||||
}
|
||||
|
||||
SkMatrix GetTotalMutationTransformationMatrix(
|
||||
|
||||
@@ -85,7 +85,8 @@ void FilterMutationsByType(
|
||||
void FilterMutationsByType(
|
||||
const FlutterPlatformView* view,
|
||||
FlutterPlatformViewMutationType type,
|
||||
std::function<void(const FlutterPlatformViewMutation& mutation)> handler);
|
||||
const std::function<void(const FlutterPlatformViewMutation& mutation)>&
|
||||
handler);
|
||||
|
||||
SkMatrix GetTotalMutationTransformationMatrix(
|
||||
const FlutterPlatformViewMutation** mutations,
|
||||
|
||||
@@ -302,7 +302,7 @@ std::ostream& DisplayListStreamDispatcher::startl() {
|
||||
}
|
||||
|
||||
template <class T>
|
||||
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) {
|
||||
|
||||
@@ -135,7 +135,7 @@ class Command {
|
||||
final List<String> args = <String>[
|
||||
filePath,
|
||||
if (options.warningsAsErrors != null)
|
||||
'--warnings-as-errors="${options.warningsAsErrors}"',
|
||||
'--warnings-as-errors=${options.warningsAsErrors}',
|
||||
if (options.checks != null)
|
||||
options.checks!,
|
||||
if (options.fix) ...<String>[
|
||||
@@ -149,6 +149,7 @@ class Command {
|
||||
<String>[tidyPath, ...args],
|
||||
workingDirectory: directory,
|
||||
name: 'clang-tidy on $filePath',
|
||||
printOutput: options.verbose,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user