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 "SkRecording.h" | 8 #include "SkRecording.h" |
9 | 9 |
10 #include "SkRecord.h" | 10 #include "SkRecord.h" |
11 #include "SkRecordCulling.h" | 11 #include "SkRecordOpts.h" |
12 #include "SkRecordDraw.h" | 12 #include "SkRecordDraw.h" |
13 #include "SkRecorder.h" | 13 #include "SkRecorder.h" |
14 | 14 |
15 namespace EXPERIMENTAL { | 15 namespace EXPERIMENTAL { |
16 | 16 |
17 SkPlayback::SkPlayback(const SkRecord* record) : fRecord(record) {} | 17 SkPlayback::SkPlayback(const SkRecord* record) : fRecord(record) {} |
18 | 18 |
19 SkPlayback::~SkPlayback() { | 19 SkPlayback::~SkPlayback() { |
20 SkDELETE(fRecord); | 20 SkDELETE(fRecord); |
21 } | 21 } |
22 | 22 |
23 void SkPlayback::draw(SkCanvas* canvas) const { | 23 void SkPlayback::draw(SkCanvas* canvas) const { |
24 SkASSERT(fRecord != NULL); | 24 SkASSERT(fRecord != NULL); |
25 SkRecordDraw(*fRecord, canvas); | 25 SkRecordDraw(*fRecord, canvas); |
26 } | 26 } |
27 | 27 |
28 /*static*/ SkRecording* SkRecording::Create(int width, int height) { | 28 /*static*/ SkRecording* SkRecording::Create(int width, int height) { |
29 return SkNEW_ARGS(SkRecording, (width, height)); | 29 return SkNEW_ARGS(SkRecording, (width, height)); |
30 } | 30 } |
31 | 31 |
32 SkRecording::SkRecording(int width, int height) { | 32 SkRecording::SkRecording(int width, int height) { |
33 SkRecord* record = SkNEW(SkRecord); | 33 SkRecord* record = SkNEW(SkRecord); |
34 fRecorder = SkNEW_ARGS(SkRecorder, (SkRecorder::kReadWrite_Mode, record, wid
th, height)); | 34 fRecorder = SkNEW_ARGS(SkRecorder, (SkRecorder::kReadWrite_Mode, record, wid
th, height)); |
35 fRecord = record; | 35 fRecord = record; |
36 } | 36 } |
37 | 37 |
38 /*static*/ const SkPlayback* SkRecording::Delete(SkRecording* recording) { | 38 /*static*/ const SkPlayback* SkRecording::Delete(SkRecording* recording) { |
39 SkRecord* record = recording->fRecord; | 39 SkRecord* record = recording->fRecord; |
40 SkRecordAnnotateCullingPairs(record); | 40 SkRecordOptimize(record); |
41 SkDELETE(recording); | 41 SkDELETE(recording); |
42 return SkNEW_ARGS(SkPlayback, (record)); | 42 return SkNEW_ARGS(SkPlayback, (record)); |
43 } | 43 } |
44 | 44 |
45 SkRecording::~SkRecording() { | 45 SkRecording::~SkRecording() { |
46 SkDELETE(fRecorder); | 46 SkDELETE(fRecorder); |
47 } | 47 } |
48 | 48 |
49 SkCanvas* SkRecording::canvas() { | 49 SkCanvas* SkRecording::canvas() { |
50 return fRecorder; | 50 return fRecorder; |
51 } | 51 } |
52 | 52 |
53 } // namespace EXPERIMENTAL | 53 } // namespace EXPERIMENTAL |
OLD | NEW |