Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 35ecb2b

Browse files
authored
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
1 parent 6257190 commit 35ecb2b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

flow/layers/backdrop_filter_layer_unittests.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ TEST_F(BackdropFilterLayerTest, SimpleFilter) {
8787
const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
8888
const SkPath child_path = SkPath().addRect(child_bounds);
8989
const SkPaint child_paint = SkPaint(SkColors::kYellow);
90-
auto layer_filter = SkImageFilters::Paint(SkPaint(SkColors::kMagenta));
90+
auto layer_filter = SkImageFilters::Shader(
91+
SkShaders::Color(SkColors::kMagenta, /*colorSpace=*/nullptr));
9192
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
9293
auto layer = std::make_shared<BackdropFilterLayer>(
9394
DlImageFilter::From(layer_filter), DlBlendMode::kSrcOver);
@@ -117,7 +118,8 @@ TEST_F(BackdropFilterLayerTest, NonSrcOverBlend) {
117118
const SkRect child_bounds = SkRect::MakeLTRB(5.0f, 6.0f, 20.5f, 21.5f);
118119
const SkPath child_path = SkPath().addRect(child_bounds);
119120
const SkPaint child_paint = SkPaint(SkColors::kYellow);
120-
auto layer_filter = SkImageFilters::Paint(SkPaint(SkColors::kMagenta));
121+
auto layer_filter = SkImageFilters::Shader(
122+
SkShaders::Color(SkColors::kMagenta, /*colorSpace=*/nullptr));
121123
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
122124
auto layer = std::make_shared<BackdropFilterLayer>(
123125
DlImageFilter::From(layer_filter), DlBlendMode::kSrc);
@@ -155,7 +157,8 @@ TEST_F(BackdropFilterLayerTest, MultipleChildren) {
155157
const SkPaint child_paint2 = SkPaint(SkColors::kCyan);
156158
SkRect children_bounds = child_path1.getBounds();
157159
children_bounds.join(child_path2.getBounds());
158-
auto layer_filter = SkImageFilters::Paint(SkPaint(SkColors::kMagenta));
160+
auto layer_filter = SkImageFilters::Shader(
161+
SkShaders::Color(SkColors::kMagenta, /*colorSpace=*/nullptr));
159162
auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
160163
auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
161164
auto layer = std::make_shared<BackdropFilterLayer>(
@@ -200,8 +203,10 @@ TEST_F(BackdropFilterLayerTest, Nested) {
200203
const SkPaint child_paint2 = SkPaint(SkColors::kCyan);
201204
SkRect children_bounds = child_path1.getBounds();
202205
children_bounds.join(child_path2.getBounds());
203-
auto layer_filter1 = SkImageFilters::Paint(SkPaint(SkColors::kMagenta));
204-
auto layer_filter2 = SkImageFilters::Paint(SkPaint(SkColors::kDkGray));
206+
auto layer_filter1 = SkImageFilters::Shader(
207+
SkShaders::Color(SkColors::kMagenta, /*colorSpace=*/nullptr));
208+
auto layer_filter2 = SkImageFilters::Shader(
209+
SkShaders::Color(SkColors::kDkGray, /*colorSpace=*/nullptr));
205210
auto mock_layer1 = std::make_shared<MockLayer>(child_path1, child_paint1);
206211
auto mock_layer2 = std::make_shared<MockLayer>(child_path2, child_paint2);
207212
auto layer1 = std::make_shared<BackdropFilterLayer>(

0 commit comments

Comments
 (0)