| Index: cc/layers/picture_layer.cc
|
| diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
|
| index 889e2fbd3f6e3ebac325bc35895276ac759c312e..b8686fa544c5eca674dceb2b4cabcb7b15d7ef3d 100644
|
| --- a/cc/layers/picture_layer.cc
|
| +++ b/cc/layers/picture_layer.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "cc/debug/benchmark_instrumentation.h"
|
| #include "cc/debug/devtools_instrumentation.h"
|
| +#include "cc/layers/content_layer_client.h"
|
| #include "cc/layers/picture_layer_impl.h"
|
| #include "cc/trees/layer_tree_impl.h"
|
| #include "ui/gfx/rect_conversions.h"
|
| @@ -130,4 +131,22 @@ bool PictureLayer::SupportsLCDText() const {
|
| return true;
|
| }
|
|
|
| +skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
|
| + // We could either flatten the PicturePile into a single SkPicture,
|
| + // or paint a fresh one depending on what we intend to do with the
|
| + // picture. For now we just paint a fresh one to get consistent results.
|
| + if (!DrawsContent())
|
| + return skia::RefPtr<SkPicture>();
|
| +
|
| + int width = bounds().width();
|
| + int height = bounds().height();
|
| + gfx::RectF opaque;
|
| +
|
| + skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| + SkCanvas* canvas = picture->beginRecording(width, height);
|
| + client_->PaintContents(canvas, gfx::Rect(width, height), &opaque);
|
| + picture->endRecording();
|
| + return picture;
|
| +}
|
| +
|
| } // namespace cc
|
|
|