OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkLayerInfo.h" | 8 #include "SkLayerInfo.h" |
9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 bbh = fBBH.get(); | 70 bbh = fBBH.get(); |
71 } | 71 } |
72 | 72 |
73 // Record the draw commands. | 73 // Record the draw commands. |
74 pictureRecord.beginRecording(); | 74 pictureRecord.beginRecording(); |
75 SkRecordDraw(*fRecord, &pictureRecord, nullptr, fDrawableList->begin(), fDra
wableList->count(), | 75 SkRecordDraw(*fRecord, &pictureRecord, nullptr, fDrawableList->begin(), fDra
wableList->count(), |
76 bbh, nullptr); | 76 bbh, nullptr); |
77 pictureRecord.endRecording(); | 77 pictureRecord.endRecording(); |
78 | 78 |
79 // Flatten the recorded commands and drawables. | 79 // Flatten the recorded commands and drawables. |
80 SkPictureData pictureData(pictureRecord, info, false); | 80 SkPictureData pictureData(pictureRecord, info); |
81 pictureData.flatten(buffer); | 81 pictureData.flatten(buffer); |
82 } | 82 } |
83 | 83 |
84 sk_sp<SkFlattenable> SkRecordedDrawable::CreateProc(SkReadBuffer& buffer) { | 84 sk_sp<SkFlattenable> SkRecordedDrawable::CreateProc(SkReadBuffer& buffer) { |
85 // Read the bounds. | 85 // Read the bounds. |
86 SkRect bounds; | 86 SkRect bounds; |
87 buffer.readRect(&bounds); | 87 buffer.readRect(&bounds); |
88 | 88 |
89 // Unflatten into a SkPictureData. | 89 // Unflatten into a SkPictureData. |
90 SkPictInfo info; | 90 SkPictInfo info; |
91 info.fCullRect = bounds; | 91 info.fCullRect = bounds; |
92 SkAutoTDelete<SkPictureData> pictureData(SkPictureData::CreateFromBuffer(buf
fer, info)); | 92 SkAutoTDelete<SkPictureData> pictureData(SkPictureData::CreateFromBuffer(buf
fer, info)); |
93 if (!pictureData) { | 93 if (!pictureData) { |
94 return nullptr; | 94 return nullptr; |
95 } | 95 } |
96 | 96 |
97 // Create a drawable. | 97 // Create a drawable. |
98 SkPicturePlayback playback(pictureData); | 98 SkPicturePlayback playback(pictureData); |
99 SkPictureRecorder recorder; | 99 SkPictureRecorder recorder; |
100 playback.draw(recorder.beginRecording(bounds), nullptr, &buffer); | 100 playback.draw(recorder.beginRecording(bounds), nullptr, &buffer); |
101 return recorder.finishRecordingAsDrawable(); | 101 return recorder.finishRecordingAsDrawable(); |
102 } | 102 } |
OLD | NEW |