| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Benchmark also find calls that always fail. | 142 // Benchmark also find calls that always fail. |
| 143 { | 143 { |
| 144 GrTextureDesc desc; | 144 GrTextureDesc desc; |
| 145 get_texture_desc(k, &desc); | 145 get_texture_desc(k, &desc); |
| 146 desc.fHeight |= 1; | 146 desc.fHeight |= 1; |
| 147 GrResourceKey key = TextureResource::ComputeKey(desc); | 147 GrResourceKey key = TextureResource::ComputeKey(desc); |
| 148 GrGpuResource* item = cache->find(key); | 148 GrGpuResource* item = cache->find(key); |
| 149 if (NULL != item) { | 149 if (item) { |
| 150 SkFAIL("cache add does not work as expected"); | 150 SkFAIL("cache add does not work as expected"); |
| 151 return; | 151 return; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 { | 154 { |
| 155 int w, h, s; | 155 int w, h, s; |
| 156 get_stencil(k, &w, &h, &s); | 156 get_stencil(k, &w, &h, &s); |
| 157 h |= 1; | 157 h |= 1; |
| 158 GrResourceKey key = StencilResource::ComputeKey(w, h, s); | 158 GrResourceKey key = StencilResource::ComputeKey(w, h, s); |
| 159 GrGpuResource* item = cache->find(key); | 159 GrGpuResource* item = cache->find(key); |
| 160 if (NULL != item) { | 160 if (item) { |
| 161 SkFAIL("cache add does not work as expected"); | 161 SkFAIL("cache add does not work as expected"); |
| 162 return; | 162 return; |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 class GrResourceCacheBenchAdd : public Benchmark { | 167 class GrResourceCacheBenchAdd : public Benchmark { |
| 168 enum { | 168 enum { |
| 169 RESOURCE_COUNT = CACHE_SIZE_COUNT / 2, | 169 RESOURCE_COUNT = CACHE_SIZE_COUNT / 2, |
| 170 DUPLICATE_COUNT = CACHE_SIZE_COUNT / 4, | 170 DUPLICATE_COUNT = CACHE_SIZE_COUNT / 4, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 230 } |
| 231 | 231 |
| 232 private: | 232 private: |
| 233 typedef Benchmark INHERITED; | 233 typedef Benchmark INHERITED; |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) | 236 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) |
| 237 DEF_BENCH( return new GrResourceCacheBenchFind(); ) | 237 DEF_BENCH( return new GrResourceCacheBenchFind(); ) |
| 238 | 238 |
| 239 #endif | 239 #endif |
| OLD | NEW |