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

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: j/k -- this one should actually be fully merged and testable 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..a0933c4e8ff40542c8e7f61b46fbbb8682d4b791 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 != nullptr && m_canvas->isRecording();
eseidel 2015/06/23 00:41:32 Hmmm. you might be right, it's possible chromium s
abarth-chromium 2015/06/23 02:28:44 Chromium style doesn't have that rule. I suspect
iansf 2015/06/23 22:46:09 Oh -- originally this was just a check of m_canvas
+}
+
+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());
+ auto picture = Picture::create(
eseidel 2015/06/23 00:41:32 As much as I like Auto, I don't think this is what
iansf 2015/06/23 22:46:09 Thanks for the explanation! Done.
+ adoptRef(m_pictureRecorder->endRecording()));
+ m_canvas->clearSkCanvas();
+ m_canvas = nullptr;
+ return picture;
}
+void PictureRecorder::set_canvas(PassRefPtr<Canvas> canvas) { m_canvas = canvas; }
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698