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

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
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..a7df3042944bb86122b6a450450d2975d8d49467 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,24 @@ 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
reed1 2015/08/10 17:58:38 "We recorded the picture as if it was at (0, 0) by
weiliangc 2015/08/10 18:09:45 My understanding is that Pixel Refs are in layer/p
vmpstr 2015/08/11 21:00:49 The translation happens during record time in the
+ // rect origin. However, now the matrix stores this offset, and the rect is
weiliangc 2015/08/10 18:09:45 Overall comment is good. I was mostly confused by
vmpstr 2015/08/11 21:00:49 Done.
+ // also offset. 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);
}
}

Powered by Google App Engine
This is Rietveld 408576698