@@ -17,6 +17,8 @@ struct Paint;
1717
1818class ColorFilter {
1919 public:
20+ // / A procedure that filters a given unpremultiplied color to produce a new
21+ // / unpremultiplied color.
2022 using ColorFilterProc = std::function<Color(Color)>;
2123
2224 ColorFilter ();
@@ -32,10 +34,19 @@ class ColorFilter {
3234
3335 static std::shared_ptr<ColorFilter> MakeLinearToSrgb ();
3436
35- virtual std::shared_ptr<ColorFilterContents> GetColorFilter (
37+ // / @brief Wraps the given filter input with a GPU-based filter that will
38+ // / perform the color operation. The given input will first be
39+ // / rendered to a texture and then filtered.
40+ // /
41+ // / Note that this operation has no consideration for the original
42+ // / geometry mask of the filter input. And the entire input texture is
43+ // / treated as color information.
44+ virtual std::shared_ptr<ColorFilterContents> WrapWithGPUColorFilter (
3645 std::shared_ptr<FilterInput> input,
3746 bool absorb_opacity) const = 0;
3847
48+ // / @brief Returns a function that can be used to filter unpremultiplied
49+ // / Impeller Colors on the CPU.
3950 virtual ColorFilterProc GetCPUColorFilterProc () const = 0;
4051};
4152
@@ -50,7 +61,7 @@ class BlendColorFilter final : public ColorFilter {
5061 ~BlendColorFilter () override ;
5162
5263 // |ColorFilter|
53- std::shared_ptr<ColorFilterContents> GetColorFilter (
64+ std::shared_ptr<ColorFilterContents> WrapWithGPUColorFilter (
5465 std::shared_ptr<FilterInput> input,
5566 bool absorb_opacity) const override ;
5667
@@ -73,7 +84,7 @@ class MatrixColorFilter final : public ColorFilter {
7384 ~MatrixColorFilter () override ;
7485
7586 // |ColorFilter|
76- std::shared_ptr<ColorFilterContents> GetColorFilter (
87+ std::shared_ptr<ColorFilterContents> WrapWithGPUColorFilter (
7788 std::shared_ptr<FilterInput> input,
7889 bool absorb_opacity) const override ;
7990
@@ -95,7 +106,7 @@ class SrgbToLinearColorFilter final : public ColorFilter {
95106 ~SrgbToLinearColorFilter () override ;
96107
97108 // |ColorFilter|
98- std::shared_ptr<ColorFilterContents> GetColorFilter (
109+ std::shared_ptr<ColorFilterContents> WrapWithGPUColorFilter (
99110 std::shared_ptr<FilterInput> input,
100111 bool absorb_opacity) const override ;
101112
@@ -114,7 +125,7 @@ class LinearToSrgbColorFilter final : public ColorFilter {
114125 ~LinearToSrgbColorFilter () override ;
115126
116127 // |ColorFilter|
117- std::shared_ptr<ColorFilterContents> GetColorFilter (
128+ std::shared_ptr<ColorFilterContents> WrapWithGPUColorFilter (
118129 std::shared_ptr<FilterInput> input,
119130 bool absorb_opacity) const override ;
120131
0 commit comments