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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // plausibly atlas-able). See if a plot can be purged and try again. | 201 // plausibly atlas-able). See if a plot can be purged and try again. |
202 if (!this->purgePlot()) { | 202 if (!this->purgePlot()) { |
203 break; // We weren't able to purge any plots | 203 break; // We weren't able to purge any plots |
204 } | 204 } |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 // The texture wouldn't fit in the cache - give it it's own texture. | 208 // The texture wouldn't fit in the cache - give it it's own texture. |
209 // This path always uses a new scratch texture and (thus) doesn't cache anyt
hing. | 209 // This path always uses a new scratch texture and (thus) doesn't cache anyt
hing. |
210 // This can yield a lot of re-rendering | 210 // This can yield a lot of re-rendering |
211 SkAutoTUnref<GrTexture> tex(fContext->lockAndRefScratchTexture(desc, | 211 SkAutoTUnref<GrTexture> tex( |
212 GrContext::kApprox_Scrat
chTexMatch)); | 212 fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); |
213 | 213 |
214 layer->setTexture(tex, GrIRect16::MakeWH(SkToS16(desc.fWidth), SkToS16(desc.
fHeight))); | 214 layer->setTexture(tex, GrIRect16::MakeWH(SkToS16(desc.fWidth), SkToS16(desc.
fHeight))); |
215 layer->setLocked(true); | 215 layer->setLocked(true); |
216 return true; | 216 return true; |
217 } | 217 } |
218 | 218 |
219 void GrLayerCache::unlock(GrCachedLayer* layer) { | 219 void GrLayerCache::unlock(GrCachedLayer* layer) { |
220 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);) | 220 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas->getTexture(), layer);) |
221 | 221 |
222 if (NULL == layer || !layer->locked()) { | 222 if (NULL == layer || !layer->locked()) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 void GrLayerCache::processDeletedPictures() { | 418 void GrLayerCache::processDeletedPictures() { |
419 SkTDArray<GrPictureDeletedMessage> deletedPictures; | 419 SkTDArray<GrPictureDeletedMessage> deletedPictures; |
420 fPictDeletionInbox.poll(&deletedPictures); | 420 fPictDeletionInbox.poll(&deletedPictures); |
421 | 421 |
422 for (int i = 0; i < deletedPictures.count(); i++) { | 422 for (int i = 0; i < deletedPictures.count(); i++) { |
423 this->purge(deletedPictures[i].pictureID); | 423 this->purge(deletedPictures[i].pictureID); |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
OLD | NEW |