Chromium Code Reviews| Index: cc/picture_pile_impl.cc |
| diff --git a/cc/picture_pile_impl.cc b/cc/picture_pile_impl.cc |
| index 35300bd70a5b691a5aa1558eed5edf76f3dd095d..f32ed1dc78d026baad81b16226e2e81d464e405d 100644 |
| --- a/cc/picture_pile_impl.cc |
| +++ b/cc/picture_pile_impl.cc |
| @@ -168,4 +168,28 @@ skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { |
| return picture; |
| } |
| +bool PicturePileImpl::IsCheapInRect( |
| + gfx::Rect content_rect, float contents_scale) const { |
| + 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::const_iterator map_iter = |
| + picture_list_map_.find(tile_iter.index()); |
| + if (map_iter == picture_list_map_.end()) |
| + continue; |
| + |
| + const PictureList& pic_list = map_iter->second; |
| + for (PictureList::const_iterator i = pic_list.begin(); |
| + i != pic_list.end(); ++i) { |
| + if (!(*i)->LayerRect().Intersects(layer_rect) || !(*i)->HasRecording()) |
| + continue; |
| + if (!(*i)->IsCheapInRect(layer_rect)) |
|
Tom Hudson
2013/02/06 12:24:57
This layer_rect is the content_rect, inverse scale
|
| + return false; |
| + } |
| + } |
| + return true; |
| +} |
| + |
| } // namespace cc |