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

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

Issue 431603002: Fix ref counting of cached layer's texture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove incorrect comment 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
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | no next file » | 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // plausibly atlas-able). See if a plot can be purged and try again. 191 // plausibly atlas-able). See if a plot can be purged and try again.
192 if (!this->purgePlot()) { 192 if (!this->purgePlot()) {
193 break; // We weren't able to purge any plots 193 break; // We weren't able to purge any plots
194 } 194 }
195 } 195 }
196 } 196 }
197 197
198 // The texture wouldn't fit in the cache - give it it's own texture. 198 // The texture wouldn't fit in the cache - give it it's own texture.
199 // This path always uses a new scratch texture and (thus) doesn't cache anyt hing. 199 // This path always uses a new scratch texture and (thus) doesn't cache anyt hing.
200 // This can yield a lot of re-rendering 200 // This can yield a lot of re-rendering
201 layer->setTexture(fContext->lockAndRefScratchTexture(desc, GrContext::kAppro x_ScratchTexMatch), 201 SkAutoTUnref<GrTexture> tex(fContext->lockAndRefScratchTexture(desc,
202 GrIRect16::MakeWH(SkToS16(desc.fWidth), SkToS16(desc.fHeig ht))); 202 GrContext::kApprox_Scrat chTexMatch));
203
204 layer->setTexture(tex, GrIRect16::MakeWH(SkToS16(desc.fWidth), SkToS16(desc. fHeight)));
203 layer->setLocked(true); 205 layer->setLocked(true);
204 return false; 206 return false;
205 } 207 }
206 208
207 void GrLayerCache::unlock(GrCachedLayer* layer) { 209 void GrLayerCache::unlock(GrCachedLayer* layer) {
208 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);) 210 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);)
209 211
210 if (NULL == layer || !layer->locked()) { 212 if (NULL == layer || !layer->locked()) {
211 // invalid or not locked 213 // invalid or not locked
212 return; 214 return;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 373
372 void GrLayerCache::processDeletedPictures() { 374 void GrLayerCache::processDeletedPictures() {
373 SkTDArray<GrPictureDeletedMessage> deletedPictures; 375 SkTDArray<GrPictureDeletedMessage> deletedPictures;
374 fPictDeletionInbox.poll(&deletedPictures); 376 fPictDeletionInbox.poll(&deletedPictures);
375 377
376 for (int i = 0; i < deletedPictures.count(); i++) { 378 for (int i = 0; i < deletedPictures.count(); i++) {
377 this->purge(deletedPictures[i].pictureID); 379 this->purge(deletedPictures[i].pictureID);
378 } 380 }
379 } 381 }
380 382
OLDNEW
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698