Chromium Code Reviews| Index: sky/engine/core/painting/PictureRecorder.cpp |
| diff --git a/sky/engine/core/painting/PictureRecorder.cpp b/sky/engine/core/painting/PictureRecorder.cpp |
| index 4896215210088f05beabeffd410676e47a4f8b2b..2b41d4039a8e807a4f97958312fa172dafb574a0 100644 |
| --- a/sky/engine/core/painting/PictureRecorder.cpp |
| +++ b/sky/engine/core/painting/PictureRecorder.cpp |
| @@ -3,31 +3,42 @@ |
| // found in the LICENSE file. |
| #include "sky/engine/config.h" |
| +#include "sky/engine/core/painting/Canvas.h" |
| #include "sky/engine/core/painting/PictureRecorder.h" |
| #include "sky/engine/core/painting/Picture.h" |
| namespace blink { |
| -PassRefPtr<PictureRecorder> PictureRecorder::create(double width, double height) |
| +PictureRecorder::PictureRecorder() |
| + : m_pictureRecorder(adoptPtr(new SkPictureRecorder())) |
| { |
| - return adoptRef(new PictureRecorder(FloatSize(width, height))); |
| } |
| -PictureRecorder::PictureRecorder(const FloatSize& size) |
| - : Canvas(size) |
| +PictureRecorder::~PictureRecorder() |
| { |
| } |
| -PictureRecorder::~PictureRecorder() |
| +bool PictureRecorder::isRecording() { |
| + return m_canvas && m_canvas->isRecording(); |
| +} |
| + |
| +SkCanvas* PictureRecorder::beginRecording(double width, double height) |
| { |
| + return m_pictureRecorder->beginRecording(width, height); |
| } |
| PassRefPtr<Picture> PictureRecorder::endRecording() |
| { |
| if (!isRecording()) |
| return nullptr; |
| - return Picture::create(finishRecording()); |
| + RefPtr<Picture> picture = Picture::create( |
| + adoptRef(m_pictureRecorder->endRecording())); |
| + m_canvas->clearSkCanvas(); |
| + m_canvas = nullptr; |
| + return picture.release(); |
| } |
| +void PictureRecorder::set_canvas(PassRefPtr<Canvas> canvas) { m_canvas = canvas; } |
|
abarth-chromium
2015/06/24 01:29:33
Usually we put trivial setters like this in the he
|
| + |
| } // namespace blink |