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 "GrAtlas.h" | 8 #include "GrAtlas.h" |
9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
10 #include "GrLayerCache.h" | 10 #include "GrLayerCache.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 *needsRendering = true; | 219 *needsRendering = true; |
220 return true; | 220 return true; |
221 } | 221 } |
222 | 222 |
223 // The layer was rejected by the atlas (even though we know it is | 223 // The layer was rejected by the atlas (even though we know it is |
224 // plausibly atlas-able). See if a plot can be purged and try again. | 224 // plausibly atlas-able). See if a plot can be purged and try again. |
225 if (!this->purgePlot()) { | 225 if (!this->purgePlot()) { |
226 break; // We weren't able to purge any plots | 226 break; // We weren't able to purge any plots |
227 } | 227 } |
228 } | 228 } |
| 229 |
| 230 if (pictInfo->fPlotUsage.isEmpty()) { |
| 231 fPictureHash.remove(pictInfo->fPictureID); |
| 232 SkDELETE(pictInfo); |
| 233 } |
229 } | 234 } |
230 | 235 |
231 return false; | 236 return false; |
232 } | 237 } |
233 | 238 |
234 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n
eedsRendering) { | 239 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n
eedsRendering) { |
235 if (layer->locked()) { | 240 if (layer->locked()) { |
236 // This layer is already locked | 241 // This layer is already locked |
237 *needsRendering = false; | 242 *needsRendering = false; |
238 return true; | 243 return true; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 fileName.appendf("\\%d", layer->fKey.pictureID()); | 495 fileName.appendf("\\%d", layer->fKey.pictureID()); |
491 for (int i = 0; i < layer->fKey.keySize(); ++i) { | 496 for (int i = 0; i < layer->fKey.keySize(); ++i) { |
492 fileName.appendf("-%d", layer->fKey.key()[i]); | 497 fileName.appendf("-%d", layer->fKey.key()[i]); |
493 } | 498 } |
494 fileName.appendf(".png"); | 499 fileName.appendf(".png"); |
495 | 500 |
496 layer->texture()->surfacePriv().savePixels(fileName.c_str()); | 501 layer->texture()->surfacePriv().savePixels(fileName.c_str()); |
497 } | 502 } |
498 } | 503 } |
499 #endif | 504 #endif |
OLD | NEW |