OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #if SK_SUPPORT_GPU | 8 #if SK_SUPPORT_GPU |
9 | 9 |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 if (NULL == context) { | 124 if (NULL == context) { |
125 return; | 125 return; |
126 } | 126 } |
127 context->setResourceCacheLimits(5, 30000); | 127 context->setResourceCacheLimits(5, 30000); |
128 GrResourceCache* cache = context->getResourceCache(); | 128 GrResourceCache* cache = context->getResourceCache(); |
129 SkDEBUGCODE(GrResourceCache2* cache2 = context->getResourceCache2();) | 129 SkDEBUGCODE(GrResourceCache2* cache2 = context->getResourceCache2();) |
130 cache->purgeAllUnlocked(); | 130 cache->purgeAllUnlocked(); |
131 SkASSERT(0 == cache->getCachedResourceCount() && 0 == cache->getCachedResour
ceBytes()); | 131 SkASSERT(0 == cache->getCachedResourceCount() && 0 == cache->getCachedResour
ceBytes()); |
132 | 132 |
133 GrCacheID::Key keyData; | 133 GrCacheID::Key keyData; |
| 134 memset(&keyData, 0, sizeof(keyData)); |
134 GrCacheID::Domain domain = GrResourceKey::ScratchDomain(); | 135 GrCacheID::Domain domain = GrResourceKey::ScratchDomain(); |
135 GrResourceKey::ResourceType t = GrResourceKey::GenerateResourceType(); | 136 GrResourceKey::ResourceType t = GrResourceKey::GenerateResourceType(); |
136 GrResourceKey scratchKey(GrCacheID(domain, keyData), t, 0); | 137 GrResourceKey scratchKey(GrCacheID(domain, keyData), t, 0); |
137 | 138 |
138 // Create two resources that have the same scratch key. | 139 // Create two resources that have the same scratch key. |
139 TestResource* a = new TestResource(context->getGpu(), scratchKey); | 140 TestResource* a = new TestResource(context->getGpu(), scratchKey); |
140 TestResource* b = new TestResource(context->getGpu(), scratchKey); | 141 TestResource* b = new TestResource(context->getGpu(), scratchKey); |
141 a->setSize(11); | 142 a->setSize(11); |
142 b->setSize(12); | 143 b->setSize(12); |
143 // Scratch resources are registered with GrResourceCache2 just by existing.
There are 2. | 144 // Scratch resources are registered with GrResourceCache2 just by existing.
There are 2. |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 457 |
457 // The below tests create their own mock contexts. | 458 // The below tests create their own mock contexts. |
458 test_duplicate_content_key(reporter); | 459 test_duplicate_content_key(reporter); |
459 test_duplicate_scratch_key(reporter); | 460 test_duplicate_scratch_key(reporter); |
460 test_purge_invalidated(reporter); | 461 test_purge_invalidated(reporter); |
461 test_cache_delete_on_destruction(reporter); | 462 test_cache_delete_on_destruction(reporter); |
462 test_resource_size_changed(reporter); | 463 test_resource_size_changed(reporter); |
463 } | 464 } |
464 | 465 |
465 #endif | 466 #endif |
OLD | NEW |