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

Unified Diff: src/record/SkRecording.cpp

Issue 233053005: Add a focused public API for src/record. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: wrap in EXPERIMENTAL Created 6 years, 8 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: src/record/SkRecording.cpp
diff --git a/src/record/SkRecording.cpp b/src/record/SkRecording.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5d48bca513148a3dd62a215e6908d9a743c2c177
--- /dev/null
+++ b/src/record/SkRecording.cpp
@@ -0,0 +1,44 @@
+#include "SkRecording.h"
robertphillips 2014/04/11 13:28:08 Header?
+
+#include "SkRecord.h"
+#include "SkRecorder.h"
+#include "SkRecordDraw.h"
+
+namespace EXPERIMENTAL {
+
+SkPlayback::SkPlayback(const SkRecord* record) : fRecord(record) {}
+
+SkPlayback::~SkPlayback() {
+ SkDELETE(fRecord);
+}
+
+void SkPlayback::draw(SkCanvas* canvas) const {
+ SkASSERT(fRecord != NULL);
+ SkRecordDraw(*fRecord, canvas);
+}
+
+/*static*/ SkRecording* SkRecording::Create(int width, int height) {
+ return SkNEW_ARGS(SkRecording, (width, height));
+}
+
+SkRecording::SkRecording(int width, int height) {
+ SkRecord* record = SkNEW(SkRecord);
+ fRecorder = SkNEW_ARGS(SkRecorder, (SkRecorder::kReadWrite_Mode, record, width, height));
+ fRecord = record;
+}
+
+/*static*/ const SkPlayback* SkRecording::Delete(SkRecording* recording) {
+ const SkRecord* record = recording->fRecord;
+ SkDELETE(recording);
+ return SkNEW_ARGS(SkPlayback, (record));
+}
+
+SkRecording::~SkRecording() {
+ SkDELETE(fRecorder);
+}
+
+SkCanvas* SkRecording::canvas() {
+ return fRecorder;
+}
+
+} // namespace EXPERIMENTAL

Powered by Google App Engine
This is Rietveld 408576698