Skip to content

Commit

Permalink
Use SkImageFilters::Shader instead of ::Paint (#37682)
Browse files Browse the repository at this point in the history
* Use SkImageFilters::Shader instead of ::Paint

SkImageFilters::Paint() is deprecated and will be removed in https://skia-review.googlesource.com/c/skia/+/604917

* Fix formatting
  • Loading branch information
lhkbob committed Nov 16, 2022
1 parent 6257190 commit 35ecb2b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions flow/layers/backdrop_filter_layer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ TEST_F(BackdropFilterLayerTest, SimpleFilter) {
const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
const SkPath child_path = SkPath().addRect(child_bounds);
const SkPaint child_paint = SkPaint(SkColors::kYellow);
auto layer_filter = SkImageFilters::Paint(SkPaint(SkColors::kMagenta));
auto layer_filter = SkImageFilters::Shader(
SkShaders::Color(SkColors::kMagenta, /*colorSpace=*/nullptr));
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<BackdropFilterLayer>(
DlImageFilter::From(layer_filter), DlBlendMode::kSrcOver);
Expand Down Expand Up @@ -117,7 +118,8 @@ TEST_F(BackdropFilterLayerTest, NonSrcOverBlend) {
const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
const SkPath child_path = SkPath().addRect(child_bounds);
const SkPaint child_paint = SkPaint(SkColors::kYellow);
auto layer_filter = SkImageFilters::Paint(SkPaint(SkColors::kMagenta));
auto layer_filter = SkImageFilters::Shader(
SkShaders::Color(SkColors::kMagenta, /*colorSpace=*/nullptr));
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<BackdropFilterLayer>(
DlImageFilter::From(layer_filter), DlBlendMode::kSrc);
Expand Down Expand Up @@ -155,7 +157,8 @@ TEST_F(BackdropFilterLayerTest, MultipleChildren) {
const SkPaint child_paint2 = SkPaint(SkColors::kCyan);
SkRect children_bounds = child_path1.getBounds();
children_bounds.join(child_path2.getBounds());
auto layer_filter = SkImageFilters::Paint(SkPaint(SkColors::kMagenta));
auto layer_filter = SkImageFilters::Shader(
SkShaders::Color(SkColors::kMagenta, /*colorSpace=*/nullptr));
auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
auto layer = std::make_shared<BackdropFilterLayer>(
Expand Down Expand Up @@ -200,8 +203,10 @@ TEST_F(BackdropFilterLayerTest, Nested) {
const SkPaint child_paint2 = SkPaint(SkColors::kCyan);
SkRect children_bounds = child_path1.getBounds();
children_bounds.join(child_path2.getBounds());
auto layer_filter1 = SkImageFilters::Paint(SkPaint(SkColors::kMagenta));
auto layer_filter2 = SkImageFilters::Paint(SkPaint(SkColors::kDkGray));
auto layer_filter1 = SkImageFilters::Shader(
SkShaders::Color(SkColors::kMagenta, /*colorSpace=*/nullptr));
auto layer_filter2 = SkImageFilters::Shader(
SkShaders::Color(SkColors::kDkGray, /*colorSpace=*/nullptr));
auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
auto layer1 = std::make_shared<BackdropFilterLayer>(
Expand Down

0 comments on commit 35ecb2b

Please sign in to comment.