| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 381 GrTexture* GrContext::createTexture(const GrTextureParams* params, | 381 GrTexture* GrContext::createTexture(const GrTextureParams* params, | 
| 382                                     const GrTextureDesc& desc, | 382                                     const GrTextureDesc& desc, | 
| 383                                     const GrCacheID& cacheID, | 383                                     const GrCacheID& cacheID, | 
| 384                                     const void* srcData, | 384                                     const void* srcData, | 
| 385                                     size_t rowBytes, | 385                                     size_t rowBytes, | 
| 386                                     GrResourceKey* cacheKey) { | 386                                     GrResourceKey* cacheKey) { | 
| 387     GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, ca
      cheID); | 387     GrResourceKey resourceKey = GrTextureImpl::ComputeKey(fGpu, params, desc, ca
      cheID); | 
| 388 | 388 | 
| 389     GrTexture* texture; | 389     GrTexture* texture; | 
| 390     if (GrTextureImpl::NeedsResizing(resourceKey)) { | 390     if (GrTextureImpl::NeedsResizing(resourceKey)) { | 
| 391         // We do not know how to resize compressed textures. |  | 
| 392         SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig)); |  | 
| 393 |  | 
| 394         texture = this->createResizedTexture(desc, cacheID, | 391         texture = this->createResizedTexture(desc, cacheID, | 
| 395                                              srcData, rowBytes, | 392                                              srcData, rowBytes, | 
| 396                                              GrTextureImpl::NeedsBilerp(resource
      Key)); | 393                                              GrTextureImpl::NeedsBilerp(resource
      Key)); | 
| 397     } else { | 394     } else { | 
| 398         texture = fGpu->createTexture(desc, srcData, rowBytes); | 395         texture= fGpu->createTexture(desc, srcData, rowBytes); | 
| 399     } | 396     } | 
| 400 | 397 | 
| 401     if (NULL != texture) { | 398     if (NULL != texture) { | 
| 402         // Adding a resource could put us overbudget. Try to free up the | 399         // Adding a resource could put us overbudget. Try to free up the | 
| 403         // necessary space before adding it. | 400         // necessary space before adding it. | 
| 404         fResourceCache->purgeAsNeeded(1, texture->gpuMemorySize()); | 401         fResourceCache->purgeAsNeeded(1, texture->gpuMemorySize()); | 
| 405         fResourceCache->addResource(resourceKey, texture); | 402         fResourceCache->addResource(resourceKey, texture); | 
| 406 | 403 | 
| 407         if (NULL != cacheKey) { | 404         if (NULL != cacheKey) { | 
| 408             *cacheKey = resourceKey; | 405             *cacheKey = resourceKey; | 
| (...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1838     SkSafeRef(resource); | 1835     SkSafeRef(resource); | 
| 1839     return resource; | 1836     return resource; | 
| 1840 } | 1837 } | 
| 1841 | 1838 | 
| 1842 /////////////////////////////////////////////////////////////////////////////// | 1839 /////////////////////////////////////////////////////////////////////////////// | 
| 1843 #if GR_CACHE_STATS | 1840 #if GR_CACHE_STATS | 
| 1844 void GrContext::printCacheStats() const { | 1841 void GrContext::printCacheStats() const { | 
| 1845     fResourceCache->printStats(); | 1842     fResourceCache->printStats(); | 
| 1846 } | 1843 } | 
| 1847 #endif | 1844 #endif | 
| OLD | NEW | 
|---|