Make flow/... compatible with .clang_tidy. (flutter/engine#47995)

Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
This commit is contained in:
Matan Lurey
2023-11-16 08:41:10 -08:00
committed by GitHub
parent 5bb5a50b0a
commit 933bd94016
26 changed files with 109 additions and 108 deletions

View File

@@ -11,6 +11,7 @@
#include "flutter/display_list/geometry/dl_region.h"
#include "flutter/fml/logging.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkRect.h"
#include "third_party/skia/include/core/SkRefCnt.h"

View File

@@ -22,7 +22,7 @@ TEST_F(BackdropFilterLayerTest, PaintingEmptyLayerDies) {
auto filter = DlBlurImageFilter(5, 5, DlTileMode::kClamp);
auto layer = std::make_shared<BackdropFilterLayer>(filter.shared(),
DlBlendMode::kSrcOver);
auto parent = std::make_shared<ClipRectLayer>(kEmptyRect, Clip::hardEdge);
auto parent = std::make_shared<ClipRectLayer>(kEmptyRect, Clip::kHardEdge);
parent->Add(layer);
parent->Preroll(preroll_context());
@@ -59,7 +59,7 @@ TEST_F(BackdropFilterLayerTest, EmptyFilter) {
auto layer =
std::make_shared<BackdropFilterLayer>(nullptr, DlBlendMode::kSrcOver);
layer->Add(mock_layer);
auto parent = std::make_shared<ClipRectLayer>(child_bounds, Clip::hardEdge);
auto parent = std::make_shared<ClipRectLayer>(child_bounds, Clip::kHardEdge);
parent->Add(layer);
preroll_context()->state_stack.set_preroll_delegate(initial_transform);
@@ -106,7 +106,7 @@ TEST_F(BackdropFilterLayerTest, SimpleFilter) {
auto layer = std::make_shared<BackdropFilterLayer>(layer_filter,
DlBlendMode::kSrcOver);
layer->Add(mock_layer);
auto parent = std::make_shared<ClipRectLayer>(child_bounds, Clip::hardEdge);
auto parent = std::make_shared<ClipRectLayer>(child_bounds, Clip::kHardEdge);
parent->Add(layer);
preroll_context()->state_stack.set_preroll_delegate(initial_transform);
@@ -154,7 +154,7 @@ TEST_F(BackdropFilterLayerTest, NonSrcOverBlend) {
auto layer =
std::make_shared<BackdropFilterLayer>(layer_filter, DlBlendMode::kSrc);
layer->Add(mock_layer);
auto parent = std::make_shared<ClipRectLayer>(child_bounds, Clip::hardEdge);
auto parent = std::make_shared<ClipRectLayer>(child_bounds, Clip::kHardEdge);
parent->Add(layer);
preroll_context()->state_stack.set_preroll_delegate(initial_transform);
@@ -214,7 +214,7 @@ TEST_F(BackdropFilterLayerTest, MultipleChildren) {
layer->Add(mock_layer1);
layer->Add(mock_layer2);
auto parent =
std::make_shared<ClipRectLayer>(children_bounds, Clip::hardEdge);
std::make_shared<ClipRectLayer>(children_bounds, Clip::kHardEdge);
parent->Add(layer);
preroll_context()->state_stack.set_preroll_delegate(initial_transform);
@@ -283,7 +283,7 @@ TEST_F(BackdropFilterLayerTest, Nested) {
layer1->Add(mock_layer1);
layer1->Add(layer2);
auto parent =
std::make_shared<ClipRectLayer>(children_bounds, Clip::hardEdge);
std::make_shared<ClipRectLayer>(children_bounds, Clip::kHardEdge);
parent->Add(layer1);
preroll_context()->state_stack.set_preroll_delegate(initial_transform);
@@ -381,7 +381,7 @@ TEST_F(BackdropFilterLayerTest, OpacityInheritance) {
const DlPaint mock_paint = DlPaint(DlColor::kRed());
const SkRect clip_rect = SkRect::MakeLTRB(0, 0, 100, 100);
auto clip = std::make_shared<ClipRectLayer>(clip_rect, Clip::hardEdge);
auto clip = std::make_shared<ClipRectLayer>(clip_rect, Clip::kHardEdge);
auto parent = std::make_shared<OpacityLayer>(128, SkPoint::Make(0, 0));
auto layer = std::make_shared<BackdropFilterLayer>(backdrop_filter.shared(),
DlBlendMode::kSrcOver);
@@ -446,7 +446,7 @@ TEST_F(BackdropLayerDiffTest, BackdropLayer) {
MockLayerTree l2(SkISize::Make(100, 100));
auto clip = std::make_shared<ClipRectLayer>(SkRect::MakeLTRB(20, 20, 60, 60),
Clip::hardEdge);
Clip::kHardEdge);
clip->Add(std::make_shared<BackdropFilterLayer>(filter.shared(),
DlBlendMode::kSrcOver));
l2.root()->Add(clip);
@@ -488,7 +488,7 @@ TEST_F(BackdropLayerDiffTest, ReadbackOutsideOfPaintArea) {
MockLayerTree l1(SkISize::Make(100, 100));
auto clip = std::make_shared<ClipRectLayer>(SkRect::MakeLTRB(60, 60, 80, 80),
Clip::hardEdge);
Clip::kHardEdge);
clip->Add(std::make_shared<BackdropFilterLayer>(filter.shared(),
DlBlendMode::kSrcOver));
l1.root()->Add(clip);

View File

@@ -26,7 +26,7 @@ TEST_F(CheckerBoardLayerTest, ClipRectSaveLayerCheckBoard) {
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRectLayer>(layer_bounds,
Clip::antiAliasWithSaveLayer);
Clip::kAntiAliasWithSaveLayer);
layer->Add(mock_layer);
preroll_context()->state_stack.set_preroll_delegate(initial_matrix);
@@ -104,8 +104,8 @@ TEST_F(CheckerBoardLayerTest, ClipPathSaveLayerCheckBoard) {
const DlPaint child_paint = DlPaint(DlColor::kYellow());
const DlPaint clip_paint;
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer =
std::make_shared<ClipPathLayer>(layer_path, Clip::antiAliasWithSaveLayer);
auto layer = std::make_shared<ClipPathLayer>(layer_path,
Clip::kAntiAliasWithSaveLayer);
layer->Add(mock_layer);
preroll_context()->state_stack.set_preroll_delegate(initial_matrix);
@@ -181,7 +181,7 @@ TEST_F(CheckerBoardLayerTest, ClipRRectSaveLayerCheckBoard) {
const DlPaint clip_paint;
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect,
Clip::antiAliasWithSaveLayer);
Clip::kAntiAliasWithSaveLayer);
layer->Add(mock_layer);
preroll_context()->state_stack.set_preroll_delegate(initial_matrix);

View File

@@ -14,7 +14,7 @@ const SkRect& ClipPathLayer::clip_shape_bounds() const {
}
void ClipPathLayer::ApplyClip(LayerStateStack::MutatorContext& mutator) const {
mutator.clipPath(clip_shape(), clip_behavior() != Clip::hardEdge);
mutator.clipPath(clip_shape(), clip_behavior() != Clip::kHardEdge);
}
} // namespace flutter

View File

@@ -12,7 +12,7 @@ namespace flutter {
class ClipPathLayer : public ClipShapeLayer<SkPath> {
public:
explicit ClipPathLayer(const SkPath& clip_path,
Clip clip_behavior = Clip::antiAlias);
Clip clip_behavior = Clip::kAntiAlias);
protected:
const SkRect& clip_shape_bounds() const override;

View File

@@ -26,12 +26,12 @@ using ClipOp = DlCanvas::ClipOp;
#ifndef NDEBUG
TEST_F(ClipPathLayerTest, ClipNoneBehaviorDies) {
EXPECT_DEATH_IF_SUPPORTED(
auto clip = std::make_shared<ClipPathLayer>(SkPath(), Clip::none),
"clip_behavior != Clip::none");
auto clip = std::make_shared<ClipPathLayer>(SkPath(), Clip::kNone),
"clip_behavior != Clip::kNone");
}
TEST_F(ClipPathLayerTest, PaintingEmptyLayerDies) {
auto layer = std::make_shared<ClipPathLayer>(SkPath(), Clip::hardEdge);
auto layer = std::make_shared<ClipPathLayer>(SkPath(), Clip::kHardEdge);
layer->Preroll(preroll_context());
@@ -50,7 +50,7 @@ TEST_F(ClipPathLayerTest, PaintingEmptyLayerDies) {
TEST_F(ClipPathLayerTest, PaintBeforePrerollDies) {
const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
const SkPath layer_path = SkPath().addRect(layer_bounds);
auto layer = std::make_shared<ClipPathLayer>(layer_path, Clip::hardEdge);
auto layer = std::make_shared<ClipPathLayer>(layer_path, Clip::kHardEdge);
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
EXPECT_FALSE(layer->needs_painting(paint_context()));
@@ -67,7 +67,7 @@ TEST_F(ClipPathLayerTest, PaintingCulledLayerDies) {
const SkPath child_path = SkPath().addRect(child_bounds);
const SkPath layer_path = SkPath().addRect(layer_bounds);
auto mock_layer = std::make_shared<MockLayer>(child_path);
auto layer = std::make_shared<ClipPathLayer>(layer_path, Clip::hardEdge);
auto layer = std::make_shared<ClipPathLayer>(layer_path, Clip::kHardEdge);
layer->Add(mock_layer);
// Cull these children
@@ -107,7 +107,7 @@ TEST_F(ClipPathLayerTest, ChildOutsideBounds) {
const SkPath clip_path = SkPath().addRect(clip_bounds);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipPathLayer>(clip_path, Clip::hardEdge);
auto layer = std::make_shared<ClipPathLayer>(clip_path, Clip::kHardEdge);
layer->Add(mock_layer);
SkRect clip_cull_rect = local_cull_bounds;
@@ -152,7 +152,7 @@ TEST_F(ClipPathLayerTest, FullyContainedChild) {
SkPath().addRect(layer_bounds).addOval(layer_bounds.makeInset(0.1, 0.1));
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipPathLayer>(layer_path, Clip::hardEdge);
auto layer = std::make_shared<ClipPathLayer>(layer_path, Clip::kHardEdge);
layer->Add(mock_layer);
preroll_context()->state_stack.set_preroll_delegate(initial_matrix);
@@ -198,7 +198,7 @@ TEST_F(ClipPathLayerTest, PartiallyContainedChild) {
SkPath().addRect(clip_bounds).addOval(clip_bounds.makeInset(0.1, 0.1));
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipPathLayer>(clip_path, Clip::hardEdge);
auto layer = std::make_shared<ClipPathLayer>(clip_path, Clip::kHardEdge);
layer->Add(mock_layer);
SkRect clip_cull_rect = local_cull_bounds;
@@ -262,9 +262,9 @@ TEST_F(ClipPathLayerTest, Readback) {
SkPath path;
DlPaint paint;
const Clip hard = Clip::hardEdge;
const Clip soft = Clip::antiAlias;
const Clip save_layer = Clip::antiAliasWithSaveLayer;
const Clip hard = Clip::kHardEdge;
const Clip soft = Clip::kAntiAlias;
const Clip save_layer = Clip::kAntiAliasWithSaveLayer;
std::shared_ptr<MockLayer> nochild;
auto reader = std::make_shared<MockLayer>(path, paint);
@@ -309,7 +309,7 @@ TEST_F(ClipPathLayerTest, OpacityInheritance) {
.addRect(SkRect::MakeLTRB(5, 5, 25, 25))
.addOval(SkRect::MakeLTRB(20, 20, 40, 50));
auto clip_path_layer =
std::make_shared<ClipPathLayer>(layer_clip, Clip::hardEdge);
std::make_shared<ClipPathLayer>(layer_clip, Clip::kHardEdge);
clip_path_layer->Add(mock1);
// ClipRectLayer will pass through compatibility from a compatible child
@@ -340,7 +340,7 @@ TEST_F(ClipPathLayerTest, OpacityInheritance) {
{
// ClipRectLayer(aa with saveLayer) will always be compatible
auto clip_path_savelayer = std::make_shared<ClipPathLayer>(
layer_clip, Clip::antiAliasWithSaveLayer);
layer_clip, Clip::kAntiAliasWithSaveLayer);
clip_path_savelayer->Add(mock1);
clip_path_savelayer->Add(mock2);
@@ -361,7 +361,7 @@ TEST_F(ClipPathLayerTest, OpacityInheritance) {
{
// ClipRectLayer with incompatible child will not be compatible
auto clip_path_bad_child =
std::make_shared<ClipPathLayer>(layer_clip, Clip::hardEdge);
std::make_shared<ClipPathLayer>(layer_clip, Clip::kHardEdge);
clip_path_bad_child->Add(mock1);
clip_path_bad_child->Add(mock2);
@@ -381,7 +381,7 @@ TEST_F(ClipPathLayerTest, OpacityInheritance) {
{
// ClipRectLayer(aa with saveLayer) will always be compatible
auto clip_path_savelayer_bad_child = std::make_shared<ClipPathLayer>(
layer_clip, Clip::antiAliasWithSaveLayer);
layer_clip, Clip::kAntiAliasWithSaveLayer);
clip_path_savelayer_bad_child->Add(mock1);
clip_path_savelayer_bad_child->Add(mock2);
@@ -405,7 +405,7 @@ TEST_F(ClipPathLayerTest, OpacityInheritancePainting) {
.addRect(SkRect::MakeLTRB(5, 5, 25, 25))
.addOval(SkRect::MakeLTRB(45, 45, 55, 55));
auto clip_path_layer =
std::make_shared<ClipPathLayer>(layer_clip, Clip::antiAlias);
std::make_shared<ClipPathLayer>(layer_clip, Clip::kAntiAlias);
clip_path_layer->Add(mock1);
clip_path_layer->Add(mock2);
@@ -457,8 +457,8 @@ TEST_F(ClipPathLayerTest, OpacityInheritanceSaveLayerPainting) {
auto layer_clip = SkPath()
.addRect(SkRect::MakeLTRB(5, 5, 25, 25))
.addOval(SkRect::MakeLTRB(20, 20, 40, 50));
auto clip_path_layer =
std::make_shared<ClipPathLayer>(layer_clip, Clip::antiAliasWithSaveLayer);
auto clip_path_layer = std::make_shared<ClipPathLayer>(
layer_clip, Clip::kAntiAliasWithSaveLayer);
clip_path_layer->Add(mock1);
clip_path_layer->Add(mock2);
@@ -507,8 +507,8 @@ TEST_F(ClipPathLayerTest, LayerCached) {
auto layer_clip = SkPath()
.addRect(SkRect::MakeLTRB(5, 5, 25, 25))
.addOval(SkRect::MakeLTRB(20, 20, 40, 50));
auto layer =
std::make_shared<ClipPathLayer>(layer_clip, Clip::antiAliasWithSaveLayer);
auto layer = std::make_shared<ClipPathLayer>(layer_clip,
Clip::kAntiAliasWithSaveLayer);
layer->Add(mock1);
auto initial_transform = SkMatrix::Translate(50.0, 25.5);
@@ -552,8 +552,8 @@ TEST_F(ClipPathLayerTest, EmptyClipDoesNotCullPlatformView) {
std::make_shared<PlatformViewLayer>(view_offset, view_size, view_id);
auto layer_clip = SkPath().addRect(kEmptyRect);
auto clip =
std::make_shared<ClipPathLayer>(layer_clip, Clip::antiAliasWithSaveLayer);
auto clip = std::make_shared<ClipPathLayer>(layer_clip,
Clip::kAntiAliasWithSaveLayer);
clip->Add(platform_view);
auto embedder = MockViewEmbedder();

View File

@@ -14,7 +14,7 @@ const SkRect& ClipRectLayer::clip_shape_bounds() const {
}
void ClipRectLayer::ApplyClip(LayerStateStack::MutatorContext& mutator) const {
mutator.clipRect(clip_shape(), clip_behavior() != Clip::hardEdge);
mutator.clipRect(clip_shape(), clip_behavior() != Clip::kHardEdge);
}
} // namespace flutter

View File

@@ -25,12 +25,12 @@ using ClipOp = DlCanvas::ClipOp;
#ifndef NDEBUG
TEST_F(ClipRectLayerTest, ClipNoneBehaviorDies) {
EXPECT_DEATH_IF_SUPPORTED(
auto clip = std::make_shared<ClipRectLayer>(kEmptyRect, Clip::none),
"clip_behavior != Clip::none");
auto clip = std::make_shared<ClipRectLayer>(kEmptyRect, Clip::kNone),
"clip_behavior != Clip::kNone");
}
TEST_F(ClipRectLayerTest, PaintingEmptyLayerDies) {
auto layer = std::make_shared<ClipRectLayer>(kEmptyRect, Clip::hardEdge);
auto layer = std::make_shared<ClipRectLayer>(kEmptyRect, Clip::kHardEdge);
layer->Preroll(preroll_context());
@@ -48,7 +48,7 @@ TEST_F(ClipRectLayerTest, PaintingEmptyLayerDies) {
TEST_F(ClipRectLayerTest, PaintBeforePrerollDies) {
const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
auto layer = std::make_shared<ClipRectLayer>(layer_bounds, Clip::hardEdge);
auto layer = std::make_shared<ClipRectLayer>(layer_bounds, Clip::kHardEdge);
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
EXPECT_FALSE(layer->needs_painting(paint_context()));
@@ -64,7 +64,7 @@ TEST_F(ClipRectLayerTest, PaintingCulledLayerDies) {
const SkRect distant_bounds = SkRect::MakeXYWH(100.0, 100.0, 10.0, 10.0);
const SkPath child_path = SkPath().addRect(child_bounds);
auto mock_layer = std::make_shared<MockLayer>(child_path);
auto layer = std::make_shared<ClipRectLayer>(layer_bounds, Clip::hardEdge);
auto layer = std::make_shared<ClipRectLayer>(layer_bounds, Clip::kHardEdge);
layer->Add(mock_layer);
// Cull these children
@@ -104,7 +104,7 @@ TEST_F(ClipRectLayerTest, ChildOutsideBounds) {
const SkPath child_path = SkPath().addRect(child_bounds);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRectLayer>(clip_rect, Clip::hardEdge);
auto layer = std::make_shared<ClipRectLayer>(clip_rect, Clip::kHardEdge);
layer->Add(mock_layer);
SkRect clip_cull_rect = local_cull_bounds;
@@ -146,7 +146,7 @@ TEST_F(ClipRectLayerTest, FullyContainedChild) {
const SkPath child_path = SkPath().addRect(child_bounds);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRectLayer>(layer_bounds, Clip::hardEdge);
auto layer = std::make_shared<ClipRectLayer>(layer_bounds, Clip::kHardEdge);
layer->Add(mock_layer);
preroll_context()->state_stack.set_preroll_delegate(initial_matrix);
@@ -190,7 +190,7 @@ TEST_F(ClipRectLayerTest, PartiallyContainedChild) {
const SkPath child_path = SkPath().addRect(child_bounds);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRectLayer>(clip_rect, Clip::hardEdge);
auto layer = std::make_shared<ClipRectLayer>(clip_rect, Clip::kHardEdge);
layer->Add(mock_layer);
SkRect clip_cull_rect = clip_rect;
@@ -251,9 +251,9 @@ TEST_F(ClipRectLayerTest, Readback) {
SkPath path;
DlPaint paint;
const Clip hard = Clip::hardEdge;
const Clip soft = Clip::antiAlias;
const Clip save_layer = Clip::antiAliasWithSaveLayer;
const Clip hard = Clip::kHardEdge;
const Clip soft = Clip::kAntiAlias;
const Clip save_layer = Clip::kAntiAliasWithSaveLayer;
std::shared_ptr<MockLayer> nochild;
auto reader = std::make_shared<MockLayer>(path, paint);
@@ -296,7 +296,7 @@ TEST_F(ClipRectLayerTest, OpacityInheritance) {
auto mock1 = MockLayer::MakeOpacityCompatible(path1);
SkRect clip_rect = SkRect::MakeWH(500, 500);
auto clip_rect_layer =
std::make_shared<ClipRectLayer>(clip_rect, Clip::hardEdge);
std::make_shared<ClipRectLayer>(clip_rect, Clip::kHardEdge);
clip_rect_layer->Add(mock1);
// ClipRectLayer will pass through compatibility from a compatible child
@@ -327,7 +327,7 @@ TEST_F(ClipRectLayerTest, OpacityInheritance) {
{
// ClipRectLayer(aa with saveLayer) will always be compatible
auto clip_path_savelayer = std::make_shared<ClipRectLayer>(
clip_rect, Clip::antiAliasWithSaveLayer);
clip_rect, Clip::kAntiAliasWithSaveLayer);
clip_path_savelayer->Add(mock1);
clip_path_savelayer->Add(mock2);
@@ -348,7 +348,7 @@ TEST_F(ClipRectLayerTest, OpacityInheritance) {
{
// ClipRectLayer with incompatible child will not be compatible
auto clip_rect_bad_child =
std::make_shared<ClipRectLayer>(clip_rect, Clip::hardEdge);
std::make_shared<ClipRectLayer>(clip_rect, Clip::kHardEdge);
clip_rect_bad_child->Add(mock1);
clip_rect_bad_child->Add(mock2);
@@ -368,7 +368,7 @@ TEST_F(ClipRectLayerTest, OpacityInheritance) {
{
// ClipRectLayer(aa with saveLayer) will always be compatible
auto clip_path_savelayer_bad_child = std::make_shared<ClipRectLayer>(
clip_rect, Clip::antiAliasWithSaveLayer);
clip_rect, Clip::kAntiAliasWithSaveLayer);
clip_path_savelayer_bad_child->Add(mock1);
clip_path_savelayer_bad_child->Add(mock2);
@@ -390,7 +390,7 @@ TEST_F(ClipRectLayerTest, OpacityInheritancePainting) {
auto mock2 = MockLayer::MakeOpacityCompatible(path2);
SkRect clip_rect = SkRect::MakeWH(500, 500);
auto clip_rect_layer =
std::make_shared<ClipRectLayer>(clip_rect, Clip::antiAlias);
std::make_shared<ClipRectLayer>(clip_rect, Clip::kAntiAlias);
clip_rect_layer->Add(mock1);
clip_rect_layer->Add(mock2);
@@ -441,7 +441,7 @@ TEST_F(ClipRectLayerTest, OpacityInheritanceSaveLayerPainting) {
children_bounds.join(path2.getBounds());
SkRect clip_rect = SkRect::MakeWH(500, 500);
auto clip_rect_layer =
std::make_shared<ClipRectLayer>(clip_rect, Clip::antiAliasWithSaveLayer);
std::make_shared<ClipRectLayer>(clip_rect, Clip::kAntiAliasWithSaveLayer);
clip_rect_layer->Add(mock1);
clip_rect_layer->Add(mock2);
@@ -489,7 +489,7 @@ TEST_F(ClipRectLayerTest, LayerCached) {
auto mock1 = MockLayer::MakeOpacityCompatible(path1);
SkRect clip_rect = SkRect::MakeWH(500, 500);
auto layer =
std::make_shared<ClipRectLayer>(clip_rect, Clip::antiAliasWithSaveLayer);
std::make_shared<ClipRectLayer>(clip_rect, Clip::kAntiAliasWithSaveLayer);
layer->Add(mock1);
auto initial_transform = SkMatrix::Translate(50.0, 25.5);
@@ -530,7 +530,7 @@ TEST_F(ClipRectLayerTest, EmptyClipDoesNotCullPlatformView) {
auto platform_view =
std::make_shared<PlatformViewLayer>(view_offset, view_size, view_id);
auto clip = std::make_shared<ClipRectLayer>(kEmptyRect, Clip::hardEdge);
auto clip = std::make_shared<ClipRectLayer>(kEmptyRect, Clip::kHardEdge);
clip->Add(platform_view);
auto embedder = MockViewEmbedder();

View File

@@ -14,7 +14,7 @@ const SkRect& ClipRRectLayer::clip_shape_bounds() const {
}
void ClipRRectLayer::ApplyClip(LayerStateStack::MutatorContext& mutator) const {
mutator.clipRRect(clip_shape(), clip_behavior() != Clip::hardEdge);
mutator.clipRRect(clip_shape(), clip_behavior() != Clip::kHardEdge);
}
} // namespace flutter

View File

@@ -26,13 +26,13 @@ using ClipOp = DlCanvas::ClipOp;
TEST_F(ClipRRectLayerTest, ClipNoneBehaviorDies) {
const SkRRect layer_rrect = SkRRect::MakeEmpty();
EXPECT_DEATH_IF_SUPPORTED(
auto clip = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::none),
"clip_behavior != Clip::none");
auto clip = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::kNone),
"clip_behavior != Clip::kNone");
}
TEST_F(ClipRRectLayerTest, PaintingEmptyLayerDies) {
const SkRRect layer_rrect = SkRRect::MakeEmpty();
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::hardEdge);
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::kHardEdge);
layer->Preroll(preroll_context());
@@ -51,7 +51,7 @@ TEST_F(ClipRRectLayerTest, PaintingEmptyLayerDies) {
TEST_F(ClipRRectLayerTest, PaintBeforePrerollDies) {
const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
const SkRRect layer_rrect = SkRRect::MakeRect(layer_bounds);
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::hardEdge);
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::kHardEdge);
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
EXPECT_EQ(layer->child_paint_bounds(), kEmptyRect);
EXPECT_FALSE(layer->needs_painting(paint_context()));
@@ -69,7 +69,7 @@ TEST_F(ClipRRectLayerTest, PaintingCulledLayerDies) {
const SkRRect layer_rrect = SkRRect::MakeRect(layer_bounds);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::hardEdge);
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::kHardEdge);
layer->Add(mock_layer);
// Cull these children
@@ -109,7 +109,7 @@ TEST_F(ClipRRectLayerTest, ChildOutsideBounds) {
const SkRRect clip_rrect = SkRRect::MakeRect(clip_bounds);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRRectLayer>(clip_rrect, Clip::hardEdge);
auto layer = std::make_shared<ClipRRectLayer>(clip_rrect, Clip::kHardEdge);
layer->Add(mock_layer);
SkRect clip_cull_rect = clip_bounds;
@@ -153,7 +153,7 @@ TEST_F(ClipRRectLayerTest, FullyContainedChild) {
const SkRRect layer_rrect = SkRRect::MakeRectXY(layer_bounds, 0.1, 0.1);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::hardEdge);
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, Clip::kHardEdge);
layer->Add(mock_layer);
preroll_context()->state_stack.set_preroll_delegate(initial_matrix);
@@ -198,7 +198,7 @@ TEST_F(ClipRRectLayerTest, PartiallyContainedChild) {
const SkRRect clip_rrect = SkRRect::MakeRectXY(clip_bounds, 0.1, 0.1);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRRectLayer>(clip_rrect, Clip::hardEdge);
auto layer = std::make_shared<ClipRRectLayer>(clip_rrect, Clip::kHardEdge);
layer->Add(mock_layer);
SkRect clip_cull_rect = clip_bounds;
@@ -259,9 +259,9 @@ TEST_F(ClipRRectLayerTest, Readback) {
SkPath path;
DlPaint paint;
const Clip hard = Clip::hardEdge;
const Clip soft = Clip::antiAlias;
const Clip save_layer = Clip::antiAliasWithSaveLayer;
const Clip hard = Clip::kHardEdge;
const Clip soft = Clip::kAntiAlias;
const Clip save_layer = Clip::kAntiAliasWithSaveLayer;
std::shared_ptr<MockLayer> nochild;
auto reader = std::make_shared<MockLayer>(path, paint);
@@ -305,7 +305,7 @@ TEST_F(ClipRRectLayerTest, OpacityInheritance) {
SkRect clip_rect = SkRect::MakeWH(500, 500);
SkRRect clip_rrect = SkRRect::MakeRectXY(clip_rect, 20, 20);
auto clip_rrect_layer =
std::make_shared<ClipRRectLayer>(clip_rrect, Clip::hardEdge);
std::make_shared<ClipRRectLayer>(clip_rrect, Clip::kHardEdge);
clip_rrect_layer->Add(mock1);
// ClipRectLayer will pass through compatibility from a compatible child
@@ -336,7 +336,7 @@ TEST_F(ClipRRectLayerTest, OpacityInheritance) {
{
// ClipRectLayer(aa with saveLayer) will always be compatible
auto clip_rrect_savelayer = std::make_shared<ClipRRectLayer>(
clip_rrect, Clip::antiAliasWithSaveLayer);
clip_rrect, Clip::kAntiAliasWithSaveLayer);
clip_rrect_savelayer->Add(mock1);
clip_rrect_savelayer->Add(mock2);
@@ -357,7 +357,7 @@ TEST_F(ClipRRectLayerTest, OpacityInheritance) {
{
// ClipRectLayer with incompatible child will not be compatible
auto clip_rrect_bad_child =
std::make_shared<ClipRRectLayer>(clip_rrect, Clip::hardEdge);
std::make_shared<ClipRRectLayer>(clip_rrect, Clip::kHardEdge);
clip_rrect_bad_child->Add(mock1);
clip_rrect_bad_child->Add(mock2);
@@ -377,7 +377,7 @@ TEST_F(ClipRRectLayerTest, OpacityInheritance) {
{
// ClipRectLayer(aa with saveLayer) will always be compatible
auto clip_rrect_savelayer_bad_child = std::make_shared<ClipRRectLayer>(
clip_rrect, Clip::antiAliasWithSaveLayer);
clip_rrect, Clip::kAntiAliasWithSaveLayer);
clip_rrect_savelayer_bad_child->Add(mock1);
clip_rrect_savelayer_bad_child->Add(mock2);
@@ -400,7 +400,7 @@ TEST_F(ClipRRectLayerTest, OpacityInheritancePainting) {
SkRect clip_rect = SkRect::MakeWH(500, 500);
SkRRect clip_rrect = SkRRect::MakeRectXY(clip_rect, 20, 20);
auto clip_rect_layer =
std::make_shared<ClipRRectLayer>(clip_rrect, Clip::antiAlias);
std::make_shared<ClipRRectLayer>(clip_rrect, Clip::kAntiAlias);
clip_rect_layer->Add(mock1);
clip_rect_layer->Add(mock2);
@@ -452,7 +452,7 @@ TEST_F(ClipRRectLayerTest, OpacityInheritanceSaveLayerPainting) {
SkRect clip_rect = SkRect::MakeWH(500, 500);
SkRRect clip_rrect = SkRRect::MakeRectXY(clip_rect, 20, 20);
auto clip_rrect_layer = std::make_shared<ClipRRectLayer>(
clip_rrect, Clip::antiAliasWithSaveLayer);
clip_rrect, Clip::kAntiAliasWithSaveLayer);
clip_rrect_layer->Add(mock1);
clip_rrect_layer->Add(mock2);
@@ -502,7 +502,7 @@ TEST_F(ClipRRectLayerTest, LayerCached) {
SkRect clip_rect = SkRect::MakeWH(500, 500);
SkRRect clip_rrect = SkRRect::MakeRectXY(clip_rect, 20, 20);
auto layer = std::make_shared<ClipRRectLayer>(clip_rrect,
Clip::antiAliasWithSaveLayer);
Clip::kAntiAliasWithSaveLayer);
layer->Add(mock1);
auto initial_transform = SkMatrix::Translate(50.0, 25.5);
@@ -541,7 +541,7 @@ TEST_F(ClipRRectLayerTest, NoSaveLayerShouldNotCache) {
auto mock1 = MockLayer::MakeOpacityCompatible(path1);
SkRect clip_rect = SkRect::MakeWH(500, 500);
SkRRect clip_rrect = SkRRect::MakeRectXY(clip_rect, 20, 20);
auto layer = std::make_shared<ClipRRectLayer>(clip_rrect, Clip::antiAlias);
auto layer = std::make_shared<ClipRRectLayer>(clip_rrect, Clip::kAntiAlias);
layer->Add(mock1);
auto initial_transform = SkMatrix::Translate(50.0, 25.5);
@@ -579,7 +579,7 @@ TEST_F(ClipRRectLayerTest, EmptyClipDoesNotCullPlatformView) {
std::make_shared<PlatformViewLayer>(view_offset, view_size, view_id);
SkRRect clip_rrect = SkRRect::MakeRectXY(kEmptyRect, 20, 20);
auto clip = std::make_shared<ClipRRectLayer>(clip_rrect, Clip::antiAlias);
auto clip = std::make_shared<ClipRRectLayer>(clip_rrect, Clip::kAntiAlias);
clip->Add(platform_view);
auto embedder = MockViewEmbedder();

View File

@@ -19,7 +19,7 @@ class ClipShapeLayer : public CacheableContainerLayer {
: CacheableContainerLayer(),
clip_shape_(clip_shape),
clip_behavior_(clip_behavior) {
FML_DCHECK(clip_behavior != Clip::none);
FML_DCHECK(clip_behavior != Clip::kNone);
}
void Diff(DiffContext* context, const Layer* old_layer) override {
@@ -100,7 +100,7 @@ class ClipShapeLayer : public CacheableContainerLayer {
}
bool UsesSaveLayer() const {
return clip_behavior_ == Clip::antiAliasWithSaveLayer;
return clip_behavior_ == Clip::kAntiAliasWithSaveLayer;
}
protected:

View File

@@ -49,14 +49,14 @@ class RasterCacheItem;
static constexpr SkRect kGiantRect = SkRect::MakeLTRB(-1E9F, -1E9F, 1E9F, 1E9F);
// This should be an exact copy of the Clip enum in painting.dart.
enum Clip { none, hardEdge, antiAlias, antiAliasWithSaveLayer };
enum Clip { kNone, kHardEdge, kAntiAlias, kAntiAliasWithSaveLayer };
struct PrerollContext {
RasterCache* raster_cache;
GrDirectContext* gr_context;
ExternalViewEmbedder* view_embedder;
LayerStateStack& state_stack;
SkColorSpace* dst_color_space;
sk_sp<SkColorSpace> dst_color_space;
bool surface_needs_readback;
// These allow us to paint in the end of subtree Preroll.
@@ -106,7 +106,7 @@ struct PaintContext {
bool rendering_above_platform_view = false;
GrDirectContext* gr_context;
SkColorSpace* dst_color_space;
sk_sp<SkColorSpace> dst_color_space;
ExternalViewEmbedder* view_embedder;
const Stopwatch& raster_time;
const Stopwatch& ui_time;

View File

@@ -6,6 +6,7 @@
#include "flutter/flow/layers/container_layer.h"
#include "flutter/flow/raster_cache_item.h"
#include "flutter/flow/raster_cache_util.h"
#include "third_party/skia/include/core/SkColorSpace.h"
namespace flutter {

View File

@@ -217,15 +217,14 @@ class LayerStateStack {
void clipPath(const SkPath& path, bool is_aa);
private:
MutatorContext(LayerStateStack* stack)
explicit MutatorContext(LayerStateStack* stack)
: layer_state_stack_(stack),
stack_restore_count_(stack->stack_count()),
save_needed_(true) {}
stack_restore_count_(stack->stack_count()) {}
friend class LayerStateStack;
LayerStateStack* layer_state_stack_;
const size_t stack_restore_count_;
bool save_needed_;
bool save_needed_ = true;
FML_DISALLOW_COPY_ASSIGN_AND_MOVE(MutatorContext);
};

View File

@@ -14,6 +14,7 @@
#include "flutter/flow/raster_cache_item.h"
#include "flutter/fml/time/time_point.h"
#include "flutter/fml/trace_event.h"
#include "include/core/SkColorSpace.h"
namespace flutter {
@@ -55,7 +56,7 @@ bool LayerTree::Preroll(CompositorContext::ScopedFrame& frame,
.gr_context = frame.gr_context(),
.view_embedder = frame.view_embedder(),
.state_stack = state_stack,
.dst_color_space = color_space,
.dst_color_space = sk_ref_sp<SkColorSpace>(color_space),
.surface_needs_readback = false,
.raster_time = frame.context().raster_time(),
.ui_time = frame.context().ui_time(),
@@ -131,7 +132,7 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame,
.state_stack = state_stack,
.canvas = canvas,
.gr_context = frame.gr_context(),
.dst_color_space = color_space,
.dst_color_space = sk_ref_sp(color_space),
.view_embedder = frame.view_embedder(),
.raster_time = frame.context().raster_time(),
.ui_time = frame.context().ui_time(),

View File

@@ -471,7 +471,7 @@ TEST_F(OpacityLayerTest, Readback) {
TEST_F(OpacityLayerTest, CullRectIsTransformed) {
auto clip_rect_layer = std::make_shared<ClipRectLayer>(
SkRect::MakeLTRB(0, 0, 10, 10), flutter::hardEdge);
SkRect::MakeLTRB(0, 0, 10, 10), Clip::kHardEdge);
auto opacity_layer =
std::make_shared<OpacityLayer>(128, SkPoint::Make(20, 20));
auto mock_layer = std::make_shared<MockLayer>(SkPath());

View File

@@ -48,9 +48,9 @@ TEST_F(PlatformViewLayerTest, ClippedPlatformViewPrerollsAndPaintsNothing) {
auto layer =
std::make_shared<PlatformViewLayer>(layer_offset, layer_size, view_id);
auto child_clip_layer =
std::make_shared<ClipRectLayer>(child_clip, Clip::hardEdge);
std::make_shared<ClipRectLayer>(child_clip, Clip::kHardEdge);
auto parent_clip_layer =
std::make_shared<ClipRectLayer>(parent_clip, Clip::hardEdge);
std::make_shared<ClipRectLayer>(parent_clip, Clip::kHardEdge);
parent_clip_layer->Add(child_clip_layer);
child_clip_layer->Add(layer);

View File

@@ -5,6 +5,7 @@
#ifndef FLUTTER_FLOW_PAINT_REGION_H_
#define FLUTTER_FLOW_PAINT_REGION_H_
#include <utility>
#include <vector>
#include "flutter/fml/logging.h"
#include "third_party/skia/include/core/SkRect.h"
@@ -30,7 +31,7 @@ class PaintRegion {
size_t to,
bool has_readback,
bool has_texture)
: rects_(rects),
: rects_(std::move(rects)),
from_(from),
to_(to),
has_readback_(has_readback),

View File

@@ -85,9 +85,8 @@ std::unique_ptr<RasterCacheResult> RasterCache::Rasterize(
SkRect dest_rect =
RasterCacheUtil::GetRoundedOutDeviceBounds(context.logical_rect, matrix);
const SkImageInfo image_info =
SkImageInfo::MakeN32Premul(dest_rect.width(), dest_rect.height(),
sk_ref_sp(context.dst_color_space));
const SkImageInfo image_info = SkImageInfo::MakeN32Premul(
dest_rect.width(), dest_rect.height(), context.dst_color_space);
sk_sp<SkSurface> surface =
context.gr_context

View File

@@ -117,7 +117,7 @@ class RasterCache {
public:
struct Context {
GrDirectContext* gr_context;
const SkColorSpace* dst_color_space;
const sk_sp<SkColorSpace> dst_color_space;
const SkMatrix& matrix;
const SkRect& logical_rect;
const char* flow_type;

View File

@@ -40,7 +40,7 @@ class UnrefQueue : public fml::RefCountedThreadSafe<UnrefQueue<T>> {
}
}
void DeleteTexture(GrBackendTexture texture) {
void DeleteTexture(const GrBackendTexture& texture) {
// drain_immediate_ should only be used on Impeller.
FML_DCHECK(!drain_immediate_);
std::scoped_lock lock(mutex_);
@@ -80,7 +80,7 @@ class UnrefQueue : public fml::RefCountedThreadSafe<UnrefQueue<T>> {
std::mutex mutex_;
std::deque<SkRefCnt*> objects_;
std::deque<GrBackendTexture> textures_;
bool drain_pending_;
bool drain_pending_ = false;
sk_sp<ResourceContext> context_;
// Enabled when there is an impeller context, which removes the usage of
// the queue altogether.
@@ -95,7 +95,6 @@ class UnrefQueue : public fml::RefCountedThreadSafe<UnrefQueue<T>> {
bool drain_immediate = false)
: task_runner_(std::move(task_runner)),
drain_delay_(delay),
drain_pending_(false),
context_(context),
drain_immediate_(drain_immediate) {}

View File

@@ -57,7 +57,7 @@ void MockRasterCache::AddMockPicture(int width, int height) {
LayerStateStack state_stack;
PaintContextHolder holder =
GetSamplePaintContextHolder(state_stack, this, &raster_time, &ui_time);
holder.paint_context.dst_color_space = color_space_.get();
holder.paint_context.dst_color_space = color_space_;
DisplayListRasterCacheItem display_list_item(display_list, SkPoint(), true,
false);
@@ -95,7 +95,7 @@ PrerollContextHolder GetSamplePrerollContextHolder(
.gr_context = nullptr,
.view_embedder = nullptr,
.state_stack = state_stack,
.dst_color_space = srgb.get(),
.dst_color_space = srgb,
.surface_needs_readback = false,
.raster_time = *raster_time,
.ui_time = *ui_time,
@@ -121,7 +121,7 @@ PaintContextHolder GetSamplePaintContextHolder(
.state_stack = state_stack,
.canvas = nullptr,
.gr_context = nullptr,
.dst_color_space = srgb.get(),
.dst_color_space = srgb,
.view_embedder = nullptr,
.raster_time = *raster_time,
.ui_time = *ui_time,

View File

@@ -84,7 +84,7 @@ class MockRasterCache : public RasterCache {
.gr_context = nullptr,
.view_embedder = nullptr,
.state_stack = preroll_state_stack_,
.dst_color_space = color_space_.get(),
.dst_color_space = color_space_,
.surface_needs_readback = false,
.raster_time = raster_time_,
.ui_time = ui_time_,
@@ -100,7 +100,7 @@ class MockRasterCache : public RasterCache {
.state_stack = paint_state_stack_,
.canvas = nullptr,
.gr_context = nullptr,
.dst_color_space = color_space_.get(),
.dst_color_space = color_space_,
.view_embedder = nullptr,
.raster_time = raster_time_,
.ui_time = ui_time_,

View File

@@ -110,7 +110,7 @@ void SceneBuilder::pushClipPath(Dart_Handle layer_handle,
int clipBehavior,
const fml::RefPtr<EngineLayer>& oldLayer) {
flutter::Clip clip_behavior = static_cast<flutter::Clip>(clipBehavior);
FML_DCHECK(clip_behavior != flutter::Clip::none);
FML_DCHECK(clip_behavior != flutter::Clip::kNone);
auto layer =
std::make_shared<flutter::ClipPathLayer>(path->path(), clip_behavior);
PushLayer(layer);

View File

@@ -939,7 +939,7 @@ TEST_F(ShellTest, PushBackdropFilterToVisitedPlatformViews) {
std::make_shared<TransformLayer>(SkMatrix::Translate(1, 1));
root->Add(transform_layer);
auto clip_rect_layer = std::make_shared<ClipRectLayer>(
SkRect::MakeLTRB(0, 0, 30, 30), Clip::hardEdge);
SkRect::MakeLTRB(0, 0, 30, 30), Clip::kHardEdge);
transform_layer->Add(clip_rect_layer);
auto filter = std::make_shared<DlBlurImageFilter>(5, 5, DlTileMode::kClamp);
auto backdrop_filter_layer =

View File

@@ -20,7 +20,7 @@ class CanvasTestBase : public BaseT {
CanvasTestBase() = default;
MockCanvas& mock_canvas() { return canvas_; }
SkColorSpace* mock_color_space() { return color_space_.get(); }
sk_sp<SkColorSpace> mock_color_space() { return color_space_; }
private:
MockCanvas canvas_;