| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |