| Index: cc/resources/picture_pile_impl.cc
|
| diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc
|
| index 397d64c0d97490d062f918a5bdddcce8e4c49158..d80737890864d6e1a70c0ae4392754aa2118497e 100644
|
| --- a/cc/resources/picture_pile_impl.cc
|
| +++ b/cc/resources/picture_pile_impl.cc
|
| @@ -198,31 +198,6 @@ int64 PicturePileImpl::Raster(
|
| return total_pixels_rasterized;
|
| }
|
|
|
| -void PicturePileImpl::GatherPixelRefs(
|
| - gfx::Rect content_rect,
|
| - float contents_scale,
|
| - std::list<skia::LazyPixelRef*>& pixel_refs) {
|
| - std::list<skia::LazyPixelRef*> result;
|
| -
|
| - gfx::Rect layer_rect = gfx::ToEnclosingRect(
|
| - gfx::ScaleRect(content_rect, 1.f / contents_scale));
|
| -
|
| - for (TilingData::Iterator tile_iter(&tiling_, layer_rect);
|
| - tile_iter; ++tile_iter) {
|
| - PictureListMap::iterator map_iter =
|
| - picture_list_map_.find(tile_iter.index());
|
| - if (map_iter == picture_list_map_.end())
|
| - continue;
|
| -
|
| - PictureList& pic_list = map_iter->second;
|
| - for (PictureList::const_iterator i = pic_list.begin();
|
| - i != pic_list.end(); ++i) {
|
| - (*i)->GatherPixelRefs(layer_rect, result);
|
| - pixel_refs.splice(pixel_refs.end(), result);
|
| - }
|
| - }
|
| -}
|
| -
|
| skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() {
|
| TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture");
|
|
|
| @@ -276,4 +251,59 @@ PicturePileImpl::Analysis::Analysis()
|
| PicturePileImpl::Analysis::~Analysis() {
|
| }
|
|
|
| +PicturePileImpl::LazyPixelRefsIterator::LazyPixelRefsIterator(
|
| + gfx::Rect content_rect,
|
| + float contents_scale,
|
| + const PicturePileImpl* picture_pile)
|
| + : picture_pile_(picture_pile),
|
| + layer_rect_(gfx::ToEnclosingRect(
|
| + gfx::ScaleRect(content_rect, 1.f / contents_scale))),
|
| + tile_iterator_(&picture_pile_->tiling_, layer_rect_),
|
| + current_pixel_ref_(NULL) {
|
| + ++(*this);
|
| +}
|
| +
|
| +PicturePileImpl::LazyPixelRefsIterator::~LazyPixelRefsIterator() {
|
| +}
|
| +
|
| +PicturePileImpl::LazyPixelRefsIterator&
|
| + PicturePileImpl::LazyPixelRefsIterator::operator++() {
|
| + while (true) {
|
| + // If there are still pixel refs on the current picture,
|
| + // advance the picture refs iterator.
|
| + if (picture_refs_iterator_) {
|
| + current_pixel_ref_ = *picture_refs_iterator_;
|
| + ++picture_refs_iterator_;
|
| + break;
|
| + }
|
| +
|
| + // If there are pictures left in the current tile's list, process them.
|
| + if (!picture_list_.empty()) {
|
| + scoped_refptr<Picture> picture = picture_list_.front();
|
| + picture_list_.pop_front();
|
| + picture_refs_iterator_ = Picture::LazyPixelRefsIterator(
|
| + layer_rect_,
|
| + picture.get());
|
| + continue;
|
| + }
|
| +
|
| + // If we're out of tiles, we're done.
|
| + if (!tile_iterator_) {
|
| + current_pixel_ref_ = NULL;
|
| + break;
|
| + }
|
| +
|
| + // Grab a new picture list from the current tile,
|
| + // and advance the tile iterator.
|
| + PictureListMap::const_iterator map_iterator =
|
| + picture_pile_->picture_list_map_.find(tile_iterator_.index());
|
| + ++tile_iterator_;
|
| + if (map_iterator == picture_pile_->picture_list_map_.end())
|
| + continue;
|
| +
|
| + picture_list_ = map_iterator->second;
|
| + }
|
| + return *this;
|
| +}
|
| +
|
| } // namespace cc
|
|
|