| Flutter Impeller |

save_layer_utils.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_ENTITY_SAVE_LAYER_UTILS_H_
6 #define FLUTTER_IMPELLER_ENTITY_SAVE_LAYER_UTILS_H_
7
8 #include <memory>
9 #include <optional>
10
11 #include "impeller/entity/contents/filters/filter_contents.h"
12 #include "impeller/geometry/rect.h"
13
14 namespace impeller {
15
16 /// @brief Compute the coverage of a subpass in the global coordinate space.
17 ///
18 /// @param content_coverage the computed coverage of the contents of the save
19 /// layer. This value may be empty if the save layer has
20 /// no contents, or Rect::Maximum if the contents are
21 /// unbounded (like a destructive blend).
22 ///
23 /// @param effect_transform The CTM of the subpass.
24 /// @param coverage_limit The current clip coverage. This is used to bound the
25 /// subpass size.
26 /// @param image_filter A subpass image filter, or nullptr.
27 /// @param flood_output_coverage Whether the coverage should be flooded to clip
28 /// coverage regardless of input coverage. This should be set to true when the
29 /// restore Paint has a destructive blend mode.
30 /// @param flood_input_coverage Whther the content coverage should be flooded.
31 /// This should be set to true if the paint has a backdrop filter or if there is
32 /// a transparent black effecting color filter.
33 ///
34 /// The coverage computation expects `content_coverage` to be in the child
35 /// coordinate space. `effect_transform` is used to transform this back into the
36 /// global coordinate space. A return value of std::nullopt indicates that the
37 /// coverage is empty or otherwise does not intersect with the parent coverage
38 /// limit and should be discarded.
39 std::optional<Rect> ComputeSaveLayerCoverage(
40 const Rect& content_coverage,
41 const Matrix& effect_transform,
42 const Rect& coverage_limit,
43 const std::shared_ptr<FilterContents>& image_filter,
44 bool flood_output_coverage = false,
45 bool flood_input_coverage = false);
46
47 } // namespace impeller
48
49 #endif // FLUTTER_IMPELLER_ENTITY_SAVE_LAYER_UTILS_H_
filter_contents.h
impeller
Definition: allocation.cc:12
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:788
impeller::ComputeSaveLayerCoverage
std::optional< Rect > ComputeSaveLayerCoverage(const Rect &content_coverage, const Matrix &effect_transform, const Rect &coverage_limit, const std::shared_ptr< FilterContents > &image_filter, bool flood_output_coverage, bool flood_input_coverage)
Compute the coverage of a subpass in the global coordinate space.
Definition: save_layer_utils.cc:19
rect.h