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 "GrLayerCache.h" | 8 #include "GrLayerCache.h" |
9 #include "GrLayerHoister.h" | 9 #include "GrLayerHoister.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 layer->start(), layer->stop()); | 132 layer->start(), layer->stop()); |
133 | 133 |
134 layerCanvas->flush(); | 134 layerCanvas->flush(); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 void GrLayerHoister::UnlockLayers(GrLayerCache* layerCache, const SkPicture* pic
ture) { | 138 void GrLayerHoister::UnlockLayers(GrLayerCache* layerCache, const SkPicture* pic
ture) { |
139 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); | 139 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); |
140 | 140 |
141 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key); | 141 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key); |
142 SkASSERT(NULL != data); | 142 SkASSERT(data); |
143 | 143 |
144 const GrAccelData *gpuData = static_cast<const GrAccelData*>(data); | 144 const GrAccelData *gpuData = static_cast<const GrAccelData*>(data); |
145 SkASSERT(0 != gpuData->numSaveLayers()); | 145 SkASSERT(0 != gpuData->numSaveLayers()); |
146 | 146 |
147 // unlock the layers | 147 // unlock the layers |
148 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { | 148 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { |
149 const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); | 149 const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); |
150 | 150 |
151 GrCachedLayer* layer = layerCache->findLayer(picture->uniqueID(), | 151 GrCachedLayer* layer = layerCache->findLayer(picture->uniqueID(), |
152 info.fSaveLayerOpID, | 152 info.fSaveLayerOpID, |
153 info.fRestoreOpID, | 153 info.fRestoreOpID, |
154 info.fOriginXform); | 154 info.fOriginXform); |
155 layerCache->unlock(layer); | 155 layerCache->unlock(layer); |
156 } | 156 } |
157 | 157 |
158 #if DISABLE_CACHING | 158 #if DISABLE_CACHING |
159 // This code completely clears out the atlas. It is required when | 159 // This code completely clears out the atlas. It is required when |
160 // caching is disabled so the atlas doesn't fill up and force more | 160 // caching is disabled so the atlas doesn't fill up and force more |
161 // free floating layers | 161 // free floating layers |
162 layerCache->purge(picture->uniqueID()); | 162 layerCache->purge(picture->uniqueID()); |
163 | 163 |
164 layerCache->purgeAll(); | 164 layerCache->purgeAll(); |
165 #endif | 165 #endif |
166 } | 166 } |
167 | 167 |
OLD | NEW |