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 "SkBigPicture.h" | 8 #include "SkBigPicture.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkDrawable.h" | 10 #include "SkDrawable.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin(
)[i]); | 88 subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin(
)[i]); |
89 } | 89 } |
90 return SkNEW_ARGS(SkBigPicture, (fCullRect, | 90 return SkNEW_ARGS(SkBigPicture, (fCullRect, |
91 fRecord.detach(), | 91 fRecord.detach(), |
92 pictList, | 92 pictList, |
93 fBBH.detach(), | 93 fBBH.detach(), |
94 saveLayerData.detach(), | 94 saveLayerData.detach(), |
95 subPictureBytes)); | 95 subPictureBytes)); |
96 } | 96 } |
97 | 97 |
| 98 SkPicture* SkPictureRecorder::endRecordingAsPicture(const SkRect& cullRect, |
| 99 SkBBHFactory* bbhFactory /*
= NULL */) { |
| 100 fCullRect = cullRect; |
| 101 |
| 102 if (bbhFactory) { |
| 103 fBBH.reset((*bbhFactory)(cullRect)); |
| 104 SkASSERT(fBBH.get()); |
| 105 } |
| 106 |
| 107 return this->endRecordingAsPicture(); |
| 108 } |
| 109 |
| 110 |
98 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const { | 111 void SkPictureRecorder::partialReplay(SkCanvas* canvas) const { |
99 if (NULL == canvas) { | 112 if (NULL == canvas) { |
100 return; | 113 return; |
101 } | 114 } |
102 | 115 |
103 int drawableCount = 0; | 116 int drawableCount = 0; |
104 SkDrawable* const* drawables = NULL; | 117 SkDrawable* const* drawables = NULL; |
105 SkDrawableList* drawableList = fRecorder->getDrawableList(); | 118 SkDrawableList* drawableList = fRecorder->getDrawableList(); |
106 if (drawableList) { | 119 if (drawableList) { |
107 drawableCount = drawableList->count(); | 120 drawableCount = drawableList->count(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 (fRecord, fBBH, fRecorder->detachDrawabl
eList(), | 205 (fRecord, fBBH, fRecorder->detachDrawabl
eList(), |
193 fCullRect, | 206 fCullRect, |
194 SkToBool(fFlags & kComputeSaveLayerInfo
_RecordFlag))); | 207 SkToBool(fFlags & kComputeSaveLayerInfo
_RecordFlag))); |
195 | 208 |
196 // release our refs now, so only the drawable will be the owner. | 209 // release our refs now, so only the drawable will be the owner. |
197 fRecord.reset(NULL); | 210 fRecord.reset(NULL); |
198 fBBH.reset(NULL); | 211 fBBH.reset(NULL); |
199 | 212 |
200 return drawable; | 213 return drawable; |
201 } | 214 } |
OLD | NEW |