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 "SkBBoxHierarchyRecord.h" | 8 #include "SkBBoxHierarchyRecord.h" |
9 #include "SkPictureRecord.h" | 9 #include "SkPictureRecord.h" |
10 #include "SkPictureRecorder.h" | 10 #include "SkPictureRecorder.h" |
11 #include "SkRecord.h" | 11 #include "SkRecord.h" |
| 12 #include "SkRecordAnalysis.h" |
12 #include "SkRecordDraw.h" | 13 #include "SkRecordDraw.h" |
13 #include "SkRecorder.h" | 14 #include "SkRecorder.h" |
14 #include "SkTypes.h" | 15 #include "SkTypes.h" |
15 | 16 |
16 SkPictureRecorder::SkPictureRecorder() {} | 17 SkPictureRecorder::SkPictureRecorder() {} |
17 | 18 |
18 SkPictureRecorder::~SkPictureRecorder() {} | 19 SkPictureRecorder::~SkPictureRecorder() {} |
19 | 20 |
20 SkCanvas* SkPictureRecorder::beginRecording(int width, int height, | 21 SkCanvas* SkPictureRecorder::beginRecording(int width, int height, |
21 SkBBHFactory* bbhFactory /* = NULL *
/, | 22 SkBBHFactory* bbhFactory /* = NULL *
/, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 if (NULL != fRecorder.get()) { | 59 if (NULL != fRecorder.get()) { |
59 return fRecorder.get(); | 60 return fRecorder.get(); |
60 } | 61 } |
61 return fPictureRecord.get(); | 62 return fPictureRecord.get(); |
62 } | 63 } |
63 | 64 |
64 SkPicture* SkPictureRecorder::endRecording() { | 65 SkPicture* SkPictureRecorder::endRecording() { |
65 SkPicture* picture = NULL; | 66 SkPicture* picture = NULL; |
66 | 67 |
67 if (NULL != fRecord.get()) { | 68 if (NULL != fRecord.get()) { |
| 69 fRecord->fAccelerationInfo = AnalyzeSkRecord(*fRecord.get()); |
68 picture = SkNEW_ARGS(SkPicture, (fWidth, fHeight, fRecord.detach(), fBBH
.get())); | 70 picture = SkNEW_ARGS(SkPicture, (fWidth, fHeight, fRecord.detach(), fBBH
.get())); |
69 } | 71 } |
70 | 72 |
71 if (NULL != fPictureRecord.get()) { | 73 if (NULL != fPictureRecord.get()) { |
72 fPictureRecord->endRecording(); | 74 fPictureRecord->endRecording(); |
73 const bool deepCopyOps = false; | 75 const bool deepCopyOps = false; |
74 picture = SkNEW_ARGS(SkPicture, (fWidth, fHeight, *fPictureRecord.get(),
deepCopyOps)); | 76 picture = SkNEW_ARGS(SkPicture, (fWidth, fHeight, *fPictureRecord.get(),
deepCopyOps)); |
75 } | 77 } |
76 | 78 |
77 return picture; | 79 return picture; |
(...skipping 13 matching lines...) Expand all Loading... |
91 if (NULL != fRecord.get()) { | 93 if (NULL != fRecord.get()) { |
92 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/); | 94 SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/); |
93 } | 95 } |
94 | 96 |
95 if (NULL != fPictureRecord.get()) { | 97 if (NULL != fPictureRecord.get()) { |
96 const bool deepCopyOps = true; | 98 const bool deepCopyOps = true; |
97 SkPicture picture(fWidth, fHeight, *fPictureRecord.get(), deepCopyOps); | 99 SkPicture picture(fWidth, fHeight, *fPictureRecord.get(), deepCopyOps); |
98 picture.draw(canvas); | 100 picture.draw(canvas); |
99 } | 101 } |
100 } | 102 } |
OLD | NEW |