Chromium Code Reviews| Index: cc/picture_pile_impl.cc |
| diff --git a/cc/picture_pile_impl.cc b/cc/picture_pile_impl.cc |
| index 05f9584ae58bb1f82306f7d244053b42a32909d1..46b161da6ba7c0c657cc8fc6eb37493c67d8fc22 100644 |
| --- a/cc/picture_pile_impl.cc |
| +++ b/cc/picture_pile_impl.cc |
| @@ -89,4 +89,29 @@ void PicturePileImpl::GatherPixelRefs( |
| } |
| } |
| +skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { |
| + TRACE_EVENT0("cc", "PicturePileImpl::FlattenToPicture"); |
| + |
| + gfx::Rect layer_rect; |
| + for (PicturePile::Pile::const_iterator i = pile_.begin(); |
| + i != pile_.end(); ++i) { |
| + layer_rect.Union((*i)->LayerRect()); |
| + } |
| + |
| + if (layer_rect.IsEmpty()) |
| + return skia::RefPtr<SkPicture>(); |
| + |
| + skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); |
|
danakj
2013/01/08 15:25:57
yay, great use of skia::RefPtr :)
|
| + SkCanvas* canvas = picture->beginRecording( |
| + layer_rect.width(), |
| + layer_rect.height(), |
| + SkPicture::kUsePathBoundsForClip_RecordingFlag); |
| + |
| + RenderingStats stats; |
| + Raster(canvas, layer_rect, 1.0, &stats); |
| + picture->endRecording(); |
| + |
| + return picture; |
| +} |
| + |
| } // namespace cc |