Chromium Code Reviews| 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..bf3b5e5d02dd5dc64331814454199b31f7590e61 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,26 @@ 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 |
|
weiliangc
2015/08/07 22:56:00
Do you mean in skia::PixelRefUtils::GatherDiscarda
vmpstr
2015/08/10 17:36:05
No I mean here at record time when we record the p
|
| + // rect origin. However, now the matrix stores this offset, and the rect is |
| + // 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()); |
| + |
| + // The pixel refs are relative to the picture origin, but we want to store |
| + // positions here |
|
ericrk
2015/08/07 00:33:56
nit: This second comment is a bit hard to follow.
vmpstr
2015/08/10 17:36:05
Ya sorry this was an unfinished comment that evolv
|
| 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); |
| } |
| } |