Chromium Code Reviews| 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 |