@@ -63,35 +63,45 @@ class Contents {
6363 const Entity& entity,
6464 RenderPass& pass) const = 0;
6565
66+ // ----------------------------------------------------------------------------
6667 // / @brief Get the screen space bounding rectangle that this contents affects.
68+ // /
6769 virtual std::optional<Rect> GetCoverage (const Entity& entity) const = 0;
6870
71+ // ----------------------------------------------------------------------------
6972 // / @brief Hint that specifies the coverage area of this Contents that will
7073 // / actually be used during rendering. This is for optimization
7174 // / purposes only and can not be relied on as a clip. May optionally
7275 // / affect the result of `GetCoverage()`.
76+ // /
7377 void SetCoverageHint (std::optional<Rect> coverage_hint);
7478
7579 const std::optional<Rect>& GetCoverageHint () const ;
7680
81+ // ----------------------------------------------------------------------------
7782 // / @brief Whether this Contents only emits opaque source colors from the
7883 // / fragment stage. This value does not account for any entity
7984 // / properties (e.g. the blend mode), clips/visibility culling, or
8085 // / inherited opacity.
86+ // /
8187 virtual bool IsOpaque () const ;
8288
89+ // ----------------------------------------------------------------------------
8390 // / @brief Given the current screen space bounding rectangle of the stencil,
8491 // / return the expected stencil coverage after this draw call. This
8592 // / should only be implemented for contents that may write to the
8693 // / stencil buffer.
94+ // /
8795 virtual StencilCoverage GetStencilCoverage (
8896 const Entity& entity,
8997 const std::optional<Rect>& current_stencil_coverage) const ;
9098
99+ // ----------------------------------------------------------------------------
91100 // / @brief Render this contents to a snapshot, respecting the entity's
92101 // / transform, path, stencil depth, and blend mode.
93102 // / The result texture size is always the size of
94103 // / `GetCoverage(entity)`.
104+ // /
95105 virtual std::optional<Snapshot> RenderToSnapshot (
96106 const ContentContext& renderer,
97107 const Entity& entity,
@@ -103,15 +113,18 @@ class Contents {
103113 virtual bool ShouldRender (const Entity& entity,
104114 const std::optional<Rect>& stencil_coverage) const ;
105115
116+ // ----------------------------------------------------------------------------
106117 // / @brief Return the color source's intrinsic size, if available.
107118 // /
108119 // / For example, a gradient has a size based on its end and beginning
109120 // / points, ignoring any tiling. Solid colors and runtime effects have
110121 // / no size.
122+ // /
111123 std::optional<Size> GetColorSourceSize () const ;
112124
113125 void SetColorSourceSize (Size size);
114126
127+ // ----------------------------------------------------------------------------
115128 // / @brief Whether or not this contents can accept the opacity peephole
116129 // / optimization.
117130 // /
@@ -120,22 +133,28 @@ class Contents {
120133 // / a way that makes accepting opacity impossible. It is always safe
121134 // / to return false, especially if computing overlap would be
122135 // / computationally expensive.
136+ // /
123137 virtual bool CanInheritOpacity (const Entity& entity) const ;
124138
139+ // ----------------------------------------------------------------------------
125140 // / @brief Inherit the provided opacity.
126141 // /
127142 // / Use of this method is invalid if CanAcceptOpacity returns false.
143+ // /
128144 virtual void SetInheritedOpacity (Scalar opacity);
129145
146+ // ----------------------------------------------------------------------------
130147 // / @brief Returns a color if this Contents will flood the given `target_size`
131148 // / with a color. This output color is the "Source" color that will be
132149 // / used for the Entity's blend operation.
133150 // /
134151 // / This is useful for absorbing full screen solid color draws into
135152 // / subpass clear colors.
153+ // /
136154 virtual std::optional<Color> AsBackgroundColor (const Entity& entity,
137155 ISize target_size) const ;
138156
157+ // ----------------------------------------------------------------------------
139158 // / @brief If possible, applies a color filter to this contents inputs on
140159 // / the CPU.
141160 // /
@@ -150,6 +169,7 @@ class Contents {
150169 // / @return True if the color filter was able to be fully applied to all
151170 // / all relevant inputs. Otherwise, this operation is a no-op and
152171 // / false is returned.
172+ // /
153173 [[nodiscard]] virtual bool ApplyColorFilter (
154174 const ColorFilterProc& color_filter_proc);
155175
0 commit comments