Chromium Code Reviews| Index: cc/layers/picture_layer.cc |
| diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc |
| index 889e2fbd3f6e3ebac325bc35895276ac759c312e..34792eb98e5faf8c2a46d1407adee3d2e8b39c0d 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 return the SkPicture in picture-pile, |
|
enne (OOO)
2013/08/20 01:25:15
This comment is a little misleading. PicturePile
alokp
2013/08/20 18:01:56
Done.
|
| + // 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()) |
|
enne (OOO)
2013/08/20 01:25:15
Can you make this early out consistent with the Co
alokp
2013/08/20 18:01:56
Done.
|
| + 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 |