diff --git a/cc/paint/display_item_list.h b/cc/paint/display_item_list.h index 12e9153191667b..6881ea31927bb0 100644 --- a/cc/paint/display_item_list.h +++ b/cc/paint/display_item_list.h @@ -181,6 +181,9 @@ class CC_PAINT_EXPORT DisplayItemList std::string ToString() const; bool has_draw_ops() const { return paint_op_buffer_.has_draw_ops(); } + // Ops with nested paint ops are considered as a single op. + size_t num_paint_ops() const { return paint_op_buffer_.size(); } + private: friend class DisplayItemListTest; friend gpu::raster::RasterImplementation; diff --git a/cc/paint/paint_recorder.cc b/cc/paint/paint_recorder.cc index 1fb95143f49a49..cded3e21e407ac 100644 --- a/cc/paint/paint_recorder.cc +++ b/cc/paint/paint_recorder.cc @@ -51,4 +51,8 @@ bool PaintRecorder::ListHasDrawOps() const { return display_item_list_->has_draw_ops(); } +size_t PaintRecorder::num_paint_ops() const { + return display_item_list_->num_paint_ops(); +} + } // namespace cc diff --git a/cc/paint/paint_recorder.h b/cc/paint/paint_recorder.h index 6beb024c236987..5195835342b136 100644 --- a/cc/paint/paint_recorder.h +++ b/cc/paint/paint_recorder.h @@ -39,6 +39,9 @@ class CC_PAINT_EXPORT PaintRecorder { bool ListHasDrawOps() const; + // Ops with nested paint ops are considered as a single op. + size_t num_paint_ops() const; + protected: virtual std::unique_ptr CreateCanvas(DisplayItemList* list, const SkRect& bounds);