OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 534 |
535 this->purgeCache(); | 535 this->purgeCache(); |
536 } | 536 } |
537 | 537 |
538 void GrContext::purgeCache() { | 538 void GrContext::purgeCache() { |
539 if (NULL != fTextureCache) { | 539 if (NULL != fTextureCache) { |
540 fTextureCache->purgeAsNeeded(); | 540 fTextureCache->purgeAsNeeded(); |
541 } | 541 } |
542 } | 542 } |
543 | 543 |
| 544 bool GrContext::OverbudgetCB(void* data) { |
| 545 GrAssert(NULL != data); |
| 546 |
| 547 GrContext* context = reinterpret_cast<GrContext*>(data); |
| 548 |
| 549 // Flush the InOrderDrawBuffer to possibly free up some textures |
| 550 context->flush(); |
| 551 |
| 552 // TODO: actually track flush's behavior rather than always just |
| 553 // returning true. |
| 554 return true; |
| 555 } |
| 556 |
| 557 |
544 GrTexture* GrContext::createUncachedTexture(const GrTextureDesc& descIn, | 558 GrTexture* GrContext::createUncachedTexture(const GrTextureDesc& descIn, |
545 void* srcData, | 559 void* srcData, |
546 size_t rowBytes) { | 560 size_t rowBytes) { |
547 GrTextureDesc descCopy = descIn; | 561 GrTextureDesc descCopy = descIn; |
548 return fGpu->createTexture(descCopy, srcData, rowBytes); | 562 return fGpu->createTexture(descCopy, srcData, rowBytes); |
549 } | 563 } |
550 | 564 |
551 void GrContext::getTextureCacheLimits(int* maxTextures, | 565 void GrContext::getTextureCacheLimits(int* maxTextures, |
552 size_t* maxTextureBytes) const { | 566 size_t* maxTextureBytes) const { |
553 fTextureCache->getLimits(maxTextures, maxTextureBytes); | 567 fTextureCache->getLimits(maxTextures, maxTextureBytes); |
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 return srcTexture; | 1855 return srcTexture; |
1842 } | 1856 } |
1843 } | 1857 } |
1844 | 1858 |
1845 /////////////////////////////////////////////////////////////////////////////// | 1859 /////////////////////////////////////////////////////////////////////////////// |
1846 #if GR_CACHE_STATS | 1860 #if GR_CACHE_STATS |
1847 void GrContext::printCacheStats() const { | 1861 void GrContext::printCacheStats() const { |
1848 fTextureCache->printStats(); | 1862 fTextureCache->printStats(); |
1849 } | 1863 } |
1850 #endif | 1864 #endif |
OLD | NEW |