| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sky/engine/core/painting/Canvas.h" | 5 #include "sky/engine/core/painting/Canvas.h" |
| 6 #include "sky/engine/core/painting/Drawable.h" |
| 6 #include "sky/engine/core/painting/Picture.h" | 7 #include "sky/engine/core/painting/Picture.h" |
| 7 #include "sky/engine/core/painting/PictureRecorder.h" | 8 #include "sky/engine/core/painting/PictureRecorder.h" |
| 8 | 9 |
| 9 namespace blink { | 10 namespace blink { |
| 10 | 11 |
| 11 PictureRecorder::PictureRecorder() | 12 PictureRecorder::PictureRecorder() |
| 12 : m_pictureRecorder(adoptPtr(new SkPictureRecorder())) | 13 : m_pictureRecorder(adoptPtr(new SkPictureRecorder())) |
| 13 { | 14 { |
| 14 } | 15 } |
| 15 | 16 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 30 { | 31 { |
| 31 if (!isRecording()) | 32 if (!isRecording()) |
| 32 return nullptr; | 33 return nullptr; |
| 33 RefPtr<Picture> picture = Picture::create( | 34 RefPtr<Picture> picture = Picture::create( |
| 34 adoptRef(m_pictureRecorder->endRecording())); | 35 adoptRef(m_pictureRecorder->endRecording())); |
| 35 m_canvas->clearSkCanvas(); | 36 m_canvas->clearSkCanvas(); |
| 36 m_canvas = nullptr; | 37 m_canvas = nullptr; |
| 37 return picture.release(); | 38 return picture.release(); |
| 38 } | 39 } |
| 39 | 40 |
| 41 PassRefPtr<Drawable> PictureRecorder::endRecordingAsDrawable() |
| 42 { |
| 43 if (!isRecording()) |
| 44 return nullptr; |
| 45 RefPtr<Drawable> drawable = Drawable::create( |
| 46 adoptRef(m_pictureRecorder->endRecordingAsDrawable())); |
| 47 m_canvas->clearSkCanvas(); |
| 48 m_canvas = nullptr; |
| 49 return drawable.release(); |
| 50 } |
| 51 |
| 40 void PictureRecorder::set_canvas(PassRefPtr<Canvas> canvas) { m_canvas = canvas;
} | 52 void PictureRecorder::set_canvas(PassRefPtr<Canvas> canvas) { m_canvas = canvas;
} |
| 41 | 53 |
| 42 } // namespace blink | 54 } // namespace blink |
| OLD | NEW |