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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
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 GrSurface*>(resource)->desc().fFlags & kRenderTarget
_GrSurfaceFlag)) { |
184 kRenderTarget_GrSurfaceFlag)) { | |
185 this->deleteResource(resource->getCacheEntry()); | 184 this->deleteResource(resource->getCacheEntry()); |
186 } | 185 } |
187 } | 186 } |
188 | 187 |
189 GrGpuResource* GrResourceCache::find(const GrResourceKey& key) { | 188 GrGpuResource* GrResourceCache::find(const GrResourceKey& key) { |
190 // GrResourceCache2 is responsible for scratch resources. | 189 // GrResourceCache2 is responsible for scratch resources. |
191 SkASSERT(!key.isScratch()); | 190 SkASSERT(!key.isScratch()); |
192 | 191 |
193 GrAutoResourceCacheValidate atcv(this); | 192 GrAutoResourceCacheValidate atcv(this); |
194 | 193 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); | 424 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", | 425 SkDebugf("\t\tEntry Count: current %d (%d locked, %d scratch %.2g%% full), h
igh %d\n", |
427 fEntryCount, locked, scratch, countUtilization, fHighWaterEntryC
ount); | 426 fEntryCount, locked, scratch, countUtilization, fHighWaterEntryC
ount); |
428 SkDebugf("\t\tEntry Bytes: current %d (%.2g%% full) high %d\n", | 427 SkDebugf("\t\tEntry Bytes: current %d (%.2g%% full) high %d\n", |
429 fEntryBytes, byteUtilization, fHighWaterEntryBytes); | 428 fEntryBytes, byteUtilization, fHighWaterEntryBytes); |
430 } | 429 } |
431 | 430 |
432 #endif | 431 #endif |
433 | 432 |
434 /////////////////////////////////////////////////////////////////////////////// | 433 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |