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

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

Issue 559603004: Separate replacement creation from layer discovery (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed initializer list order Created 6 years, 3 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
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::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(uint32_t pictureID, 120 GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID,
121 int start, int stop, 121 int start, int stop,
122 const SkIPoint& offset, 122 const SkIPoint& offset,
123 const SkMatrix& ctm) { 123 const SkMatrix& ctm,
124 const SkPaint* paint) {
124 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0); 125 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0);
125 126
126 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, of fset, ctm)); 127 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, of fset, ctm, paint));
127 fLayerHash.add(layer); 128 fLayerHash.add(layer);
128 return layer; 129 return layer;
129 } 130 }
130 131
131 GrCachedLayer* GrLayerCache::findLayer(uint32_t pictureID, 132 GrCachedLayer* GrLayerCache::findLayer(uint32_t pictureID,
132 int start, int stop, 133 int start, int stop,
133 const SkIPoint& offset, 134 const SkIPoint& offset,
134 const SkMatrix& ctm) { 135 const SkMatrix& ctm) {
135 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0); 136 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0);
136 return fLayerHash.find(GrCachedLayer::Key(pictureID, start, stop, offset, ct m)); 137 return fLayerHash.find(GrCachedLayer::Key(pictureID, start, stop, offset, ct m));
137 } 138 }
138 139
139 GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID, 140 GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID,
140 int start, int stop, 141 int start, int stop,
141 const SkIPoint& offset, 142 const SkIPoint& offset,
142 const SkMatrix& ctm) { 143 const SkMatrix& ctm,
144 const SkPaint* paint) {
143 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0); 145 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0);
144 GrCachedLayer* layer = fLayerHash.find(GrCachedLayer::Key(pictureID, start, stop, offset, ctm)); 146 GrCachedLayer* layer = fLayerHash.find(GrCachedLayer::Key(pictureID, start, stop, offset, ctm));
145 if (NULL == layer) { 147 if (NULL == layer) {
146 layer = this->createLayer(pictureID, start, stop, offset, ctm); 148 layer = this->createLayer(pictureID, start, stop, offset, ctm, paint);
147 } 149 }
148 150
149 return layer; 151 return layer;
150 } 152 }
151 153
152 bool GrLayerCache::lock(GrCachedLayer* layer, const GrTextureDesc& desc, bool do ntAtlas) { 154 bool GrLayerCache::lock(GrCachedLayer* layer, const GrTextureDesc& desc, bool do ntAtlas) {
153 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);) 155 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);)
154 156
155 if (layer->locked()) { 157 if (layer->locked()) {
156 // This layer is already locked 158 // This layer is already locked
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 419
418 void GrLayerCache::processDeletedPictures() { 420 void GrLayerCache::processDeletedPictures() {
419 SkTDArray<GrPictureDeletedMessage> deletedPictures; 421 SkTDArray<GrPictureDeletedMessage> deletedPictures;
420 fPictDeletionInbox.poll(&deletedPictures); 422 fPictDeletionInbox.poll(&deletedPictures);
421 423
422 for (int i = 0; i < deletedPictures.count(); i++) { 424 for (int i = 0; i < deletedPictures.count(); i++) {
423 this->purge(deletedPictures[i].pictureID); 425 this->purge(deletedPictures[i].pictureID);
424 } 426 }
425 } 427 }
426 428
OLDNEW
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698