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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // plausibly atlas-able). See if a plot can be purged and try again. | 210 // plausibly atlas-able). See if a plot can be purged and try again. |
211 if (!this->purgePlot()) { | 211 if (!this->purgePlot()) { |
212 break; // We weren't able to purge any plots | 212 break; // We weren't able to purge any plots |
213 } | 213 } |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 // The texture wouldn't fit in the cache - give it it's own texture. | 217 // The texture wouldn't fit in the cache - give it it's own texture. |
218 // This path always uses a new scratch texture and (thus) doesn't cache anyt
hing. | 218 // This path always uses a new scratch texture and (thus) doesn't cache anyt
hing. |
219 // This can yield a lot of re-rendering | 219 // This can yield a lot of re-rendering |
220 SkAutoTUnref<GrTexture> tex(fContext->lockAndRefScratchTexture(desc, | 220 SkAutoTUnref<GrTexture> tex( |
221 GrContext::kApprox_Scrat
chTexMatch)); | 221 fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); |
222 | 222 |
223 layer->setTexture(tex, GrIRect16::MakeWH(SkToS16(desc.fWidth), SkToS16(desc.
fHeight))); | 223 layer->setTexture(tex, GrIRect16::MakeWH(SkToS16(desc.fWidth), SkToS16(desc.
fHeight))); |
224 layer->setLocked(true); | 224 layer->setLocked(true); |
225 return true; | 225 return true; |
226 } | 226 } |
227 | 227 |
228 void GrLayerCache::unlock(GrCachedLayer* layer) { | 228 void GrLayerCache::unlock(GrCachedLayer* layer) { |
229 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);) | 229 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);) |
230 | 230 |
231 if (NULL == layer || !layer->locked()) { | 231 if (NULL == layer || !layer->locked()) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 void GrLayerCache::processDeletedPictures() { | 428 void GrLayerCache::processDeletedPictures() { |
429 SkTDArray<GrPictureDeletedMessage> deletedPictures; | 429 SkTDArray<GrPictureDeletedMessage> deletedPictures; |
430 fPictDeletionInbox.poll(&deletedPictures); | 430 fPictDeletionInbox.poll(&deletedPictures); |
431 | 431 |
432 for (int i = 0; i < deletedPictures.count(); i++) { | 432 for (int i = 0; i < deletedPictures.count(); i++) { |
433 this->purge(deletedPictures[i].pictureID); | 433 this->purge(deletedPictures[i].pictureID); |
434 } | 434 } |
435 } | 435 } |
436 | 436 |
OLD | NEW |