Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: sky/engine/core/painting/PictureRecorder.cpp

Issue 1190123003: Decouple Canvas from DisplayList and map Picture and PictureRecorder more directly to their Skia co… (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebased version of previous patch Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698