| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 GrCachedLayer* layer = &(*iter); | 105 GrCachedLayer* layer = &(*iter); |
| 106 this->unlock(layer); | 106 this->unlock(layer); |
| 107 SkDELETE(layer); | 107 SkDELETE(layer); |
| 108 } | 108 } |
| 109 fLayerHash.rewind(); | 109 fLayerHash.rewind(); |
| 110 | 110 |
| 111 // The atlas only lets go of its texture when the atlas is deleted. | 111 // The atlas only lets go of its texture when the atlas is deleted. |
| 112 fAtlas.free(); | 112 fAtlas.free(); |
| 113 // GrLayerCache always assumes an atlas exists so recreate it. The atlas | 113 // GrLayerCache always assumes an atlas exists so recreate it. The atlas |
| 114 // lazily allocates a replacement texture so reallocating a new | 114 // lazily allocates a replacement texture so reallocating a new |
| 115 // atlas here won't disrupt a GrContext::abandonContext or freeGpuResources. | 115 // atlas here won't disrupt a GrContext::contextDestroyed or freeGpuResource
s. |
| 116 // TODO: Make GrLayerCache lazily allocate the atlas manager? | 116 // TODO: Make GrLayerCache lazily allocate the atlas manager? |
| 117 this->initAtlas(); | 117 this->initAtlas(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID, | 120 GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID, |
| 121 int start, int stop, | 121 int start, int stop, |
| 122 const SkMatrix& ctm) { | 122 const SkMatrix& ctm) { |
| 123 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0); | 123 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0); |
| 124 | 124 |
| 125 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, ct
m)); | 125 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, ct
m)); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 void GrLayerCache::processDeletedPictures() { | 415 void GrLayerCache::processDeletedPictures() { |
| 416 SkTDArray<GrPictureDeletedMessage> deletedPictures; | 416 SkTDArray<GrPictureDeletedMessage> deletedPictures; |
| 417 fPictDeletionInbox.poll(&deletedPictures); | 417 fPictDeletionInbox.poll(&deletedPictures); |
| 418 | 418 |
| 419 for (int i = 0; i < deletedPictures.count(); i++) { | 419 for (int i = 0; i < deletedPictures.count(); i++) { |
| 420 this->purge(deletedPictures[i].pictureID); | 420 this->purge(deletedPictures[i].pictureID); |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 | 423 |
| OLD | NEW |