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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkDrawable.h" | 9 #include "SkDrawable.h" |
10 #include "SkLayerInfo.h" | 10 #include "SkLayerInfo.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 SkDrawableList* drawableList = fRecorder->getDrawableList(); | 54 SkDrawableList* drawableList = fRecorder->getDrawableList(); |
55 SkPicture::SnapshotArray* pictList = drawableList ? drawableList->newDrawabl
eSnapshot() : NULL; | 55 SkPicture::SnapshotArray* pictList = drawableList ? drawableList->newDrawabl
eSnapshot() : NULL; |
56 | 56 |
57 if (fBBH.get()) { | 57 if (fBBH.get()) { |
58 if (saveLayerData) { | 58 if (saveLayerData) { |
59 SkRecordComputeLayers(fCullRect, *fRecord, pictList, fBBH.get(), sav
eLayerData); | 59 SkRecordComputeLayers(fCullRect, *fRecord, pictList, fBBH.get(), sav
eLayerData); |
60 } else { | 60 } else { |
61 SkRecordFillBounds(fCullRect, *fRecord, fBBH.get()); | 61 SkRecordFillBounds(fCullRect, *fRecord, fBBH.get()); |
62 } | 62 } |
| 63 SkRect bbhBound = fBBH->getRootBound(); |
| 64 SkASSERT((bbhBound.isEmpty() || fCullRect.contains(bbhBound)) |
| 65 || (bbhBound.isEmpty() && fCullRect.isEmpty())); |
| 66 fCullRect = bbhBound; |
63 } | 67 } |
64 | 68 |
65 SkPicture* pict = SkNEW_ARGS(SkPicture, (fCullRect, fRecord, pictList, fBBH)
); | 69 SkPicture* pict = SkNEW_ARGS(SkPicture, (fCullRect, fRecord, pictList, fBBH)
); |
66 | 70 |
67 if (saveLayerData) { | 71 if (saveLayerData) { |
68 pict->EXPERIMENTAL_addAccelData(saveLayerData); | 72 pict->EXPERIMENTAL_addAccelData(saveLayerData); |
69 } | 73 } |
70 | 74 |
71 // release our refs now, so only the picture will be the owner. | 75 // release our refs now, so only the picture will be the owner. |
72 fRecorder.reset(NULL); | 76 fRecorder.reset(NULL); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 fCullRect, | 170 fCullRect, |
167 SkToBool(fFlags & kComputeSaveLayerInfo
_RecordFlag))); | 171 SkToBool(fFlags & kComputeSaveLayerInfo
_RecordFlag))); |
168 | 172 |
169 // release our refs now, so only the drawable will be the owner. | 173 // release our refs now, so only the drawable will be the owner. |
170 fRecorder.reset(NULL); | 174 fRecorder.reset(NULL); |
171 fRecord.reset(NULL); | 175 fRecord.reset(NULL); |
172 fBBH.reset(NULL); | 176 fBBH.reset(NULL); |
173 | 177 |
174 return drawable; | 178 return drawable; |
175 } | 179 } |
OLD | NEW |