OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 #include "GrResourceCache.h" | 9 #include "GrResourceCache.h" |
10 #include "GrGpuResource.h" | 10 #include "GrGpuResource.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 174 } |
175 | 175 |
176 void GrResourceCache::notifyPurgable(const GrGpuResource* resource) { | 176 void GrResourceCache::notifyPurgable(const GrGpuResource* resource) { |
177 // Remove scratch textures from the cache the moment they become purgeable i
f | 177 // Remove scratch textures from the cache the moment they become purgeable i
f |
178 // scratch texture reuse is turned off. | 178 // scratch texture reuse is turned off. |
179 SkASSERT(resource->getCacheEntry()); | 179 SkASSERT(resource->getCacheEntry()); |
180 if (resource->getCacheEntry()->key().getResourceType() == GrTexturePriv::Res
ourceType() && | 180 if (resource->getCacheEntry()->key().getResourceType() == GrTexturePriv::Res
ourceType() && |
181 resource->getCacheEntry()->key().isScratch() && | 181 resource->getCacheEntry()->key().isScratch() && |
182 !fCaps->reuseScratchTextures() && | 182 !fCaps->reuseScratchTextures() && |
183 !(static_cast<const GrTexture*>(resource)->desc().fFlags & | 183 !(static_cast<const GrTexture*>(resource)->desc().fFlags & |
184 kRenderTarget_GrTextureFlagBit)) { | 184 kRenderTarget_GrSurfaceFlag)) { |
185 this->deleteResource(resource->getCacheEntry()); | 185 this->deleteResource(resource->getCacheEntry()); |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 GrGpuResource* GrResourceCache::find(const GrResourceKey& key) { | 189 GrGpuResource* GrResourceCache::find(const GrResourceKey& key) { |
190 // GrResourceCache2 is responsible for scratch resources. | 190 // GrResourceCache2 is responsible for scratch resources. |
191 SkASSERT(!key.isScratch()); | 191 SkASSERT(!key.isScratch()); |
192 | 192 |
193 GrAutoResourceCacheValidate atcv(this); | 193 GrAutoResourceCacheValidate atcv(this); |
194 | 194 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); | 425 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); |
426 SkDebugf("\t\tEntry Count: current %d (%d locked, %d scratch %.2g%% full), h
igh %d\n", | 426 SkDebugf("\t\tEntry Count: current %d (%d locked, %d scratch %.2g%% full), h
igh %d\n", |
427 fEntryCount, locked, scratch, countUtilization, fHighWaterEntryC
ount); | 427 fEntryCount, locked, scratch, countUtilization, fHighWaterEntryC
ount); |
428 SkDebugf("\t\tEntry Bytes: current %d (%.2g%% full) high %d\n", | 428 SkDebugf("\t\tEntry Bytes: current %d (%.2g%% full) high %d\n", |
429 fEntryBytes, byteUtilization, fHighWaterEntryBytes); | 429 fEntryBytes, byteUtilization, fHighWaterEntryBytes); |
430 } | 430 } |
431 | 431 |
432 #endif | 432 #endif |
433 | 433 |
434 /////////////////////////////////////////////////////////////////////////////// | 434 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |