Make `flow/...` compatible with `.clang_tidy`. (#47995)
Work towards https://github.com/flutter/flutter/issues/134969.
All changes were made automatically (i.e. with `--fix`).
diff --git a/display_list/geometry/dl_rtree.h b/display_list/geometry/dl_rtree.h
index efda161..32913d4 100644
--- a/display_list/geometry/dl_rtree.h
+++ b/display_list/geometry/dl_rtree.h
@@ -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"
diff --git a/flow/layers/backdrop_filter_layer_unittests.cc b/flow/layers/backdrop_filter_layer_unittests.cc
index 5e38f74..8dacf8e 100644
--- a/flow/layers/backdrop_filter_layer_unittests.cc
+++ b/flow/layers/backdrop_filter_layer_unittests.cc
@@ -22,7 +22,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
diff --git a/flow/layers/checkerboard_layertree_unittests.cc b/flow/layers/checkerboard_layertree_unittests.cc
index 61489a6..c1173d9 100644
--- a/flow/layers/checkerboard_layertree_unittests.cc
+++ b/flow/layers/checkerboard_layertree_unittests.cc
@@ -26,7 +26,7 @@
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 @@
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 @@
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);
diff --git a/flow/layers/clip_path_layer.cc b/flow/layers/clip_path_layer.cc
index 5a8961f..acd633a 100644
--- a/flow/layers/clip_path_layer.cc
+++ b/flow/layers/clip_path_layer.cc
@@ -14,7 +14,7 @@
}
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
diff --git a/flow/layers/clip_path_layer.h b/flow/layers/clip_path_layer.h
index 5a1cbff..e183a48 100644
--- a/flow/layers/clip_path_layer.h
+++ b/flow/layers/clip_path_layer.h
@@ -12,7 +12,7 @@
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;
diff --git a/flow/layers/clip_path_layer_unittests.cc b/flow/layers/clip_path_layer_unittests.cc
index 582ae97..62ce30c 100644
--- a/flow/layers/clip_path_layer_unittests.cc
+++ b/flow/layers/clip_path_layer_unittests.cc
@@ -26,12 +26,12 @@
#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, 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
.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 @@
{
// 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 @@
{
// 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 @@
{
// 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 @@
.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 @@
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 @@
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 @@
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();
diff --git a/flow/layers/clip_rect_layer.cc b/flow/layers/clip_rect_layer.cc
index b141ec8..dfb0293 100644
--- a/flow/layers/clip_rect_layer.cc
+++ b/flow/layers/clip_rect_layer.cc
@@ -14,7 +14,7 @@
}
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
diff --git a/flow/layers/clip_rect_layer_unittests.cc b/flow/layers/clip_rect_layer_unittests.cc
index 55359b3..c1d0d80 100644
--- a/flow/layers/clip_rect_layer_unittests.cc
+++ b/flow/layers/clip_rect_layer_unittests.cc
@@ -25,12 +25,12 @@
#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, 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
{
// 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 @@
{
// 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 @@
{
// 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 @@
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 @@
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 @@
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 @@
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();
diff --git a/flow/layers/clip_rrect_layer.cc b/flow/layers/clip_rrect_layer.cc
index 735d027..87262cb 100644
--- a/flow/layers/clip_rrect_layer.cc
+++ b/flow/layers/clip_rrect_layer.cc
@@ -14,7 +14,7 @@
}
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
diff --git a/flow/layers/clip_rrect_layer_unittests.cc b/flow/layers/clip_rrect_layer_unittests.cc
index 1c3672d..3fc556d 100644
--- a/flow/layers/clip_rrect_layer_unittests.cc
+++ b/flow/layers/clip_rrect_layer_unittests.cc
@@ -26,13 +26,13 @@
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, 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
{
// 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 @@
{
// 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 @@
{
// 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 @@
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 @@
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 @@
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 @@
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 @@
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();
diff --git a/flow/layers/clip_shape_layer.h b/flow/layers/clip_shape_layer.h
index 69c479f..4510671 100644
--- a/flow/layers/clip_shape_layer.h
+++ b/flow/layers/clip_shape_layer.h
@@ -19,7 +19,7 @@
: 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 @@
}
bool UsesSaveLayer() const {
- return clip_behavior_ == Clip::antiAliasWithSaveLayer;
+ return clip_behavior_ == Clip::kAntiAliasWithSaveLayer;
}
protected:
diff --git a/flow/layers/layer.h b/flow/layers/layer.h
index 617f922..36ae36f 100644
--- a/flow/layers/layer.h
+++ b/flow/layers/layer.h
@@ -49,14 +49,14 @@
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 @@
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;
diff --git a/flow/layers/layer_raster_cache_item.cc b/flow/layers/layer_raster_cache_item.cc
index 61c0f85..de5a5e6 100644
--- a/flow/layers/layer_raster_cache_item.cc
+++ b/flow/layers/layer_raster_cache_item.cc
@@ -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 {
diff --git a/flow/layers/layer_state_stack.h b/flow/layers/layer_state_stack.h
index 613bf21..ec5ea49 100644
--- a/flow/layers/layer_state_stack.h
+++ b/flow/layers/layer_state_stack.h
@@ -217,15 +217,14 @@
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);
};
diff --git a/flow/layers/layer_tree.cc b/flow/layers/layer_tree.cc
index 5f75aaf..d9e26e7 100644
--- a/flow/layers/layer_tree.cc
+++ b/flow/layers/layer_tree.cc
@@ -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 @@
.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 @@
.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(),
diff --git a/flow/layers/opacity_layer_unittests.cc b/flow/layers/opacity_layer_unittests.cc
index f69ac4e..e9c0db8 100644
--- a/flow/layers/opacity_layer_unittests.cc
+++ b/flow/layers/opacity_layer_unittests.cc
@@ -471,7 +471,7 @@
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());
diff --git a/flow/layers/platform_view_layer_unittests.cc b/flow/layers/platform_view_layer_unittests.cc
index 0c83f71..fd58203 100644
--- a/flow/layers/platform_view_layer_unittests.cc
+++ b/flow/layers/platform_view_layer_unittests.cc
@@ -48,9 +48,9 @@
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);
diff --git a/flow/paint_region.h b/flow/paint_region.h
index be12c82..52f2976 100644
--- a/flow/paint_region.h
+++ b/flow/paint_region.h
@@ -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 @@
size_t to,
bool has_readback,
bool has_texture)
- : rects_(rects),
+ : rects_(std::move(rects)),
from_(from),
to_(to),
has_readback_(has_readback),
diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc
index 92f22f8..81800d1 100644
--- a/flow/raster_cache.cc
+++ b/flow/raster_cache.cc
@@ -85,9 +85,8 @@
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
diff --git a/flow/raster_cache.h b/flow/raster_cache.h
index a00508f..463892a 100644
--- a/flow/raster_cache.h
+++ b/flow/raster_cache.h
@@ -117,7 +117,7 @@
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;
diff --git a/flow/skia_gpu_object.h b/flow/skia_gpu_object.h
index 0b5cf99..b5edbad 100644
--- a/flow/skia_gpu_object.h
+++ b/flow/skia_gpu_object.h
@@ -40,7 +40,7 @@
}
}
- 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 @@
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 @@
bool drain_immediate = false)
: task_runner_(std::move(task_runner)),
drain_delay_(delay),
- drain_pending_(false),
context_(context),
drain_immediate_(drain_immediate) {}
diff --git a/flow/testing/mock_raster_cache.cc b/flow/testing/mock_raster_cache.cc
index 9effd6a..aa99f25 100644
--- a/flow/testing/mock_raster_cache.cc
+++ b/flow/testing/mock_raster_cache.cc
@@ -57,7 +57,7 @@
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 @@
.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 @@
.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,
diff --git a/flow/testing/mock_raster_cache.h b/flow/testing/mock_raster_cache.h
index 877351f..908ff2f 100644
--- a/flow/testing/mock_raster_cache.h
+++ b/flow/testing/mock_raster_cache.h
@@ -84,7 +84,7 @@
.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 @@
.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_,
diff --git a/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc
index ec0d59c..6f535f3 100644
--- a/lib/ui/compositing/scene_builder.cc
+++ b/lib/ui/compositing/scene_builder.cc
@@ -110,7 +110,7 @@
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);
diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc
index a504776..d0c5b6d 100644
--- a/shell/common/shell_unittests.cc
+++ b/shell/common/shell_unittests.cc
@@ -939,7 +939,7 @@
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 =
diff --git a/testing/canvas_test.h b/testing/canvas_test.h
index 9d7ee87..c62e7e4 100644
--- a/testing/canvas_test.h
+++ b/testing/canvas_test.h
@@ -20,7 +20,7 @@
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_;