@@ -140,9 +140,17 @@ class LayerStateStack {
140140 // Fill the provided paint object with any oustanding attributes and
141141 // return a pointer to it, or return a nullptr if there were no
142142 // outstanding attributes to paint with.
143- DlPaint* fill (DlPaint& paint) { return outstanding_.fill (paint); }
143+ DlPaint* fill (DlPaint& paint) const { return outstanding_.fill (paint); }
144144
145- bool needs_painting () { return outstanding_.opacity > 0 ; }
145+ // Tests if painting content with the current outstanding attributes
146+ // will produce any content.
147+ bool needs_painting () const { return outstanding_.opacity > 0 ; }
148+
149+ // Tests if painting content with the given bounds will produce any output.
150+ // This method also tests whether the outstanding attributes will allow
151+ // output to be produced, but then goes on to test if the supplied bounds
152+ // will fall within the current clip bounds based on the transform.
153+ bool needs_painting (const SkRect& bounds) const ;
146154
147155 // Saves the current state of the state stack and returns a
148156 // MutatorContext which can be used to manipulate the state.
@@ -214,10 +222,12 @@ class LayerStateStack {
214222 std::shared_ptr<const DlColorFilter> color_filter;
215223 std::shared_ptr<const DlImageFilter> image_filter;
216224
217- SkPaint* fill (SkPaint& paint, DlBlendMode mode = DlBlendMode::kSrcOver );
218- DlPaint* fill (DlPaint& paint, DlBlendMode mode = DlBlendMode::kSrcOver );
225+ SkPaint* fill (SkPaint& paint,
226+ DlBlendMode mode = DlBlendMode::kSrcOver ) const ;
227+ DlPaint* fill (DlPaint& paint,
228+ DlBlendMode mode = DlBlendMode::kSrcOver ) const ;
219229
220- bool operator ==(const RenderingAttributes& other) {
230+ bool operator ==(const RenderingAttributes& other) const {
221231 return save_layer_bounds == other.save_layer_bounds &&
222232 opacity == other.opacity &&
223233 Equals (color_filter, other.color_filter ) &&
0 commit comments