Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: src/gpu/GrLayerCache.cpp

Issue 481443002: Add GrResourceCache2. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove removeHead Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::contextDestroyed or freeGpuResource s. 115 // atlas here won't disrupt a GrContext::abandonContext or freeGpuResources.
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(const SkPicture* picture, 120 GrCachedLayer* GrLayerCache::createLayer(const SkPicture* picture,
121 int start, int stop, 121 int start, int stop,
122 const SkMatrix& ctm) { 122 const SkMatrix& ctm) {
123 SkASSERT(picture->uniqueID() != SK_InvalidGenID && start > 0 && stop > 0); 123 SkASSERT(picture->uniqueID() != SK_InvalidGenID && start > 0 && stop > 0);
124 124
125 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (picture->uniqueID(), start , stop, ctm)); 125 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (picture->uniqueID(), start , stop, ctm));
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 void GrLayerCache::processDeletedPictures() { 394 void GrLayerCache::processDeletedPictures() {
395 SkTDArray<GrPictureDeletedMessage> deletedPictures; 395 SkTDArray<GrPictureDeletedMessage> deletedPictures;
396 fPictDeletionInbox.poll(&deletedPictures); 396 fPictDeletionInbox.poll(&deletedPictures);
397 397
398 for (int i = 0; i < deletedPictures.count(); i++) { 398 for (int i = 0; i < deletedPictures.count(); i++) {
399 this->purge(deletedPictures[i].pictureID); 399 this->purge(deletedPictures[i].pictureID);
400 } 400 }
401 } 401 }
402 402
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698