Index: cc/picture_pile_impl.cc |
diff --git a/cc/picture_pile_impl.cc b/cc/picture_pile_impl.cc |
index 571dcc6a09e55af20064e2dd06b20d67f0a6081e..cb4ff2b76fe85f4bf9d3b15ce3d99e65b6d64e21 100644 |
--- a/cc/picture_pile_impl.cc |
+++ b/cc/picture_pile_impl.cc |
@@ -97,4 +97,29 @@ void PicturePileImpl::GatherPixelRefs( |
} |
} |
+skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { |
+ TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); |
+ |
+ gfx::Rect layer_rect; |
+ for (PicturePile::Pile::const_iterator i = pile_.begin(); |
+ i != pile_.end(); ++i) { |
+ layer_rect.Union((*i)->LayerRect()); |
+ } |
+ |
+ skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); |
+ if (layer_rect.IsEmpty()) |
+ return picture; |
+ |
+ 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 |