Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2522)

Unified Diff: cc/picture_pile_impl.cc

Issue 12192025: Add cheapness predictor success histogram (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased the change on top of (partial) 12194015 Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/picture_pile_impl.h ('k') | cc/test/fake_picture_layer_tiling_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cc/picture_pile_impl.h ('k') | cc/test/fake_picture_layer_tiling_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698