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

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

Issue 1122423009: Make it possible to custom-paint without an Element. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Comment tweak Created 5 years, 7 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
new file mode 100644
index 0000000000000000000000000000000000000000..4896215210088f05beabeffd410676e47a4f8b2b
--- /dev/null
+++ b/sky/engine/core/painting/PictureRecorder.cpp
@@ -0,0 +1,33 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sky/engine/config.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)
+{
+ return adoptRef(new PictureRecorder(FloatSize(width, height)));
+}
+
+PictureRecorder::PictureRecorder(const FloatSize& size)
+ : Canvas(size)
+{
+}
+
+PictureRecorder::~PictureRecorder()
+{
+}
+
+PassRefPtr<Picture> PictureRecorder::endRecording()
+{
+ if (!isRecording())
+ return nullptr;
+ return Picture::create(finishRecording());
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698