Chromium Code Reviews| Index: cc/resources/picture_pile_base.cc |
| diff --git a/cc/resources/picture_pile_base.cc b/cc/resources/picture_pile_base.cc |
| index 897ed2cbe7a4ea6b4dd62fb5f22b4978538f0221..0d3a72504e2d60644dbe9df88e9bbdb46a25a29b 100644 |
| --- a/cc/resources/picture_pile_base.cc |
| +++ b/cc/resources/picture_pile_base.cc |
| @@ -8,6 +8,9 @@ |
| #include <vector> |
| #include "base/logging.h" |
| +#include "base/values.h" |
| +#include "cc/base/math_util.h" |
| +#include "cc/debug/traced_value.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "ui/gfx/rect_conversions.h" |
| @@ -173,4 +176,25 @@ bool PicturePileBase::CanRaster(float contents_scale, gfx::Rect content_rect) { |
| return recorded_region_.Contains(layer_rect); |
| } |
| +scoped_ptr<base::Value> PicturePileBase::AsValue() const { |
| + scoped_ptr<base::ListValue> rects(new base::ListValue()); |
|
enne (OOO)
2013/05/14 15:55:18
rects => pictures?
|
| + gfx::Rect layer_rect(tiling_.total_size()); /* enne, insane or not? */ |
|
enne (OOO)
2013/05/14 15:55:18
This is right. You could also simplify this a lit
|
| + 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; |
| + if (pic_list.empty()) |
| + continue; |
| + for (PictureList::const_reverse_iterator i = pic_list.rbegin(); |
| + i != pic_list.rend(); ++i) { |
| + Picture* picture = (*i).get(); |
| + rects->Append(TracedValue::CreateIDRef(picture).release()); |
| + } |
| + } |
| + return rects.PassAs<base::Value>(); |
| +} |
| + |
| } // namespace cc |