From 35ecb2bf4139051ce090c6906a89ebe129b2df89 Mon Sep 17 00:00:00 2001 From: Michael Ludwig Date: Wed, 16 Nov 2022 15:56:57 -0500 Subject: [PATCH] Use SkImageFilters::Shader instead of ::Paint (#37682) * 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 --- flow/layers/backdrop_filter_layer_unittests.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/flow/layers/backdrop_filter_layer_unittests.cc b/flow/layers/backdrop_filter_layer_unittests.cc index 49a214bd76e73..fa157522714c7 100644 --- a/flow/layers/backdrop_filter_layer_unittests.cc +++ b/flow/layers/backdrop_filter_layer_unittests.cc @@ -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(child_path, child_paint); auto layer = std::make_shared( DlImageFilter::From(layer_filter), DlBlendMode::kSrcOver); @@ -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(child_path, child_paint); auto layer = std::make_shared( DlImageFilter::From(layer_filter), DlBlendMode::kSrc); @@ -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(child_path1, child_paint1); auto mock_layer2 = std::make_shared(child_path2, child_paint2); auto layer = std::make_shared( @@ -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(child_path1, child_paint1); auto mock_layer2 = std::make_shared(child_path2, child_paint2); auto layer1 = std::make_shared(