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

Unified Diff: cc/playback/pixel_ref_map.cc

Issue 1279843004: cc: Plumb more details about pixel refs to tile manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/playback/pixel_ref_map.h ('k') | cc/playback/pixel_ref_map_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/pixel_ref_map.cc
diff --git a/cc/playback/pixel_ref_map.cc b/cc/playback/pixel_ref_map.cc
index cf8c93503aad37f5f85b0c2bf04ef3b5038fac6e..a8181e8188f833005160cc7681c7ef8e302ac485 100644
--- a/cc/playback/pixel_ref_map.cc
+++ b/cc/playback/pixel_ref_map.cc
@@ -21,7 +21,8 @@ PixelRefMap::PixelRefMap(const gfx::Size& cell_size) : cell_size_(cell_size) {
PixelRefMap::~PixelRefMap() {
}
-void PixelRefMap::GatherPixelRefsFromPicture(SkPicture* picture) {
+void PixelRefMap::GatherPixelRefsFromPicture(SkPicture* picture,
+ const gfx::Rect& layer_rect) {
DCHECK(picture);
int min_x = std::numeric_limits<int>::max();
@@ -45,10 +46,23 @@ void PixelRefMap::GatherPixelRefsFromPicture(SkPicture* picture) {
static_cast<int>(std::ceil(it->pixel_ref_rect.bottom())),
cell_size_.height()));
+ // We recorded the picture as if it was at (0, 0) by translating by layer
+ // rect origin. Add the rect origin back here. It really doesn't make much
+ // of a difference, since the query for pixel refs doesn't use this
+ // information. However, since picture pile / display list also returns this
+ // information, it would be nice to express it relative to the layer, not
+ // relative to the particular implementation of the raster source.
+ skia::PositionPixelRef position_pixel_ref = *it;
+ position_pixel_ref.pixel_ref_rect.setXYWH(
+ position_pixel_ref.pixel_ref_rect.x() + layer_rect.x(),
+ position_pixel_ref.pixel_ref_rect.y() + layer_rect.y(),
+ position_pixel_ref.pixel_ref_rect.width(),
+ position_pixel_ref.pixel_ref_rect.height());
+
for (int y = min.y(); y <= max.y(); y += cell_size_.height()) {
for (int x = min.x(); x <= max.x(); x += cell_size_.width()) {
PixelRefMapKey key(x, y);
- data_hash_map_[key].push_back(it->pixel_ref);
+ data_hash_map_[key].push_back(position_pixel_ref);
}
}
« no previous file with comments | « cc/playback/pixel_ref_map.h ('k') | cc/playback/pixel_ref_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698