| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "../../include/record/SkRecording.h" | 8 #include "../../include/record/SkRecording.h" |
| 9 | 9 |
| 10 #include "SkRecord.h" | 10 #include "SkRecord.h" |
| 11 #include "SkRecordAnalysis.h" |
| 11 #include "SkRecordOpts.h" | 12 #include "SkRecordOpts.h" |
| 12 #include "SkRecordDraw.h" | 13 #include "SkRecordDraw.h" |
| 13 #include "SkRecorder.h" | 14 #include "SkRecorder.h" |
| 14 | 15 |
| 15 namespace EXPERIMENTAL { | 16 namespace EXPERIMENTAL { |
| 16 | 17 |
| 17 SkPlayback::SkPlayback(const SkRecord* record) : fRecord(record) {} | 18 SkPlayback::SkPlayback(const SkRecord* record) |
| 19 : fRecord(record) |
| 20 , fWillPlaybackBitmaps (SkRecordWillPlaybackBitmaps(*record)) { |
| 21 |
| 22 } |
| 18 | 23 |
| 19 SkPlayback::~SkPlayback() {} | 24 SkPlayback::~SkPlayback() {} |
| 20 | 25 |
| 21 void SkPlayback::draw(SkCanvas* canvas) const { | 26 void SkPlayback::draw(SkCanvas* canvas) const { |
| 22 SkASSERT(fRecord.get() != NULL); | 27 SkASSERT(fRecord.get() != NULL); |
| 23 SkRecordDraw(*fRecord, canvas); | 28 SkRecordDraw(*fRecord, canvas); |
| 24 } | 29 } |
| 25 | 30 |
| 26 SkRecording::SkRecording(int width, int height) | 31 SkRecording::SkRecording(int width, int height) |
| 27 : fRecord(SkNEW(SkRecord)) | 32 : fRecord(SkNEW(SkRecord)) |
| 28 , fRecorder(SkNEW_ARGS(SkRecorder, (fRecord.get(), width, height))) | 33 , fRecorder(SkNEW_ARGS(SkRecorder, (fRecord.get(), width, height))) |
| 29 {} | 34 {} |
| 30 | 35 |
| 31 SkPlayback* SkRecording::releasePlayback() { | 36 SkPlayback* SkRecording::releasePlayback() { |
| 32 SkASSERT(fRecorder->unique()); | 37 SkASSERT(fRecorder->unique()); |
| 33 fRecorder->forgetRecord(); | 38 fRecorder->forgetRecord(); |
| 34 SkRecordOptimize(fRecord.get()); | 39 SkRecordOptimize(fRecord.get()); |
| 35 return SkNEW_ARGS(SkPlayback, (fRecord.detach())); | 40 return SkNEW_ARGS(SkPlayback, (fRecord.detach())); |
| 36 } | 41 } |
| 37 | 42 |
| 38 SkRecording::~SkRecording() {} | 43 SkRecording::~SkRecording() {} |
| 39 | 44 |
| 40 SkCanvas* SkRecording::canvas() { | 45 SkCanvas* SkRecording::canvas() { |
| 41 return fRecord.get() ? fRecorder.get() : NULL; | 46 return fRecord.get() ? fRecorder.get() : NULL; |
| 42 } | 47 } |
| 43 | 48 |
| 44 } // namespace EXPERIMENTAL | 49 } // namespace EXPERIMENTAL |
| OLD | NEW |