31 const std::shared_ptr<Geometry>& geometry)
const {
40 contents->ApplyColorFilter(
color_filter->GetCPUColorFilterProc())) {
41 needs_color_filter =
false;
44 contents->SetGeometry(geometry);
57 std::shared_ptr<Contents> input)
const {
68 std::shared_ptr<Contents> input,
69 const Matrix& effect_transform)
const {
92 const Matrix& effect_transform,
98 filter->SetRenderingMode(rendering_mode);
99 filter->SetEffectTransform(effect_transform);
103 std::shared_ptr<Contents> Paint::WithColorFilter(
104 std::shared_ptr<Contents> input,
120 if (input->ApplyColorFilter(
color_filter->GetCPUColorFilterProc())) {
128 std::shared_ptr<TextureContents> texture_contents)
const {
131 texture_contents->SetSourceRect(
132 texture_contents->GetSourceRect().Expand(expand_amount, expand_amount));
133 auto mask = std::make_shared<SolidColorContents>();
135 std::optional<Rect> coverage = texture_contents->GetCoverage({});
136 std::shared_ptr<Geometry> geometry;
138 texture_contents->SetDestinationRect(
139 coverage.value().Expand(expand_amount, expand_amount));
142 mask->SetGeometry(geometry);
143 auto descriptor = texture_contents->GetSamplerDescriptor();
144 texture_contents->SetSamplerDescriptor(descriptor);
145 std::shared_ptr<FilterContents> blurred_mask =
156 std::shared_ptr<ColorSourceContents> color_source_contents,
157 const std::shared_ptr<ColorFilter>&
color_filter)
const {
160 if (color_source_contents->IsSolidColor() && !
color_filter) {
168 auto mask = std::make_shared<SolidColorContents>();
170 mask->SetGeometry(color_source_contents->GetGeometry());
176 color_source_contents->GetGeometry());
182 auto expanded_local_bounds = blurred_mask->GetCoverage({});
183 if (!expanded_local_bounds.has_value()) {
184 expanded_local_bounds =
Rect();
186 color_source_contents->SetGeometry(
188 std::shared_ptr<Contents> color_contents = color_source_contents;
208 const Matrix& ctm)
const {
209 Vector2 blur_sigma(sigma.sigma, sigma.sigma);
213 if (is_solid_color) {