| 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 |
| 11 #include "Benchmark.h" | 11 #include "Benchmark.h" |
| 12 #include "GrGpuResource.h" | 12 #include "GrGpuResource.h" |
| 13 #include "GrContext.h" | 13 #include "GrContext.h" |
| 14 #include "GrResourceCache.h" | 14 #include "GrResourceCache.h" |
| 15 #include "GrStencilBuffer.h" | 15 #include "GrStencilBuffer.h" |
| 16 #include "GrTexture.h" | 16 #include "GrTexture.h" |
| 17 #include "GrTexturePriv.h" | |
| 18 #include "SkCanvas.h" | 17 #include "SkCanvas.h" |
| 19 | 18 |
| 20 enum { | 19 enum { |
| 21 CACHE_SIZE_COUNT = 2048, | 20 CACHE_SIZE_COUNT = 2048, |
| 22 CACHE_SIZE_BYTES = 2 * 1024 * 1024, | 21 CACHE_SIZE_BYTES = 2 * 1024 * 1024, |
| 23 }; | 22 }; |
| 24 | 23 |
| 25 class StencilResource : public GrGpuResource { | 24 class StencilResource : public GrGpuResource { |
| 26 public: | 25 public: |
| 27 SK_DECLARE_INST_COUNT(StencilResource); | 26 SK_DECLARE_INST_COUNT(StencilResource); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 56 this->registerWithCache(); | 55 this->registerWithCache(); |
| 57 } | 56 } |
| 58 | 57 |
| 59 virtual ~TextureResource() { this->release(); } | 58 virtual ~TextureResource() { this->release(); } |
| 60 | 59 |
| 61 virtual size_t gpuMemorySize() const SK_OVERRIDE { | 60 virtual size_t gpuMemorySize() const SK_OVERRIDE { |
| 62 return 100 + ((fID % 1 == 0) ? -40 : 33); | 61 return 100 + ((fID % 1 == 0) ? -40 : 33); |
| 63 } | 62 } |
| 64 | 63 |
| 65 static GrResourceKey ComputeKey(const GrTextureDesc& desc) { | 64 static GrResourceKey ComputeKey(const GrTextureDesc& desc) { |
| 66 return GrTexturePriv::ComputeScratchKey(desc); | 65 return GrTextureImpl::ComputeScratchKey(desc); |
| 67 } | 66 } |
| 68 | 67 |
| 69 int fID; | 68 int fID; |
| 70 | 69 |
| 71 private: | 70 private: |
| 72 typedef GrGpuResource INHERITED; | 71 typedef GrGpuResource INHERITED; |
| 73 }; | 72 }; |
| 74 | 73 |
| 75 static void get_stencil(int i, int* w, int* h, int* s) { | 74 static void get_stencil(int i, int* w, int* h, int* s) { |
| 76 *w = i % 1024; | 75 *w = i % 1024; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 230 } |
| 232 | 231 |
| 233 private: | 232 private: |
| 234 typedef Benchmark INHERITED; | 233 typedef Benchmark INHERITED; |
| 235 }; | 234 }; |
| 236 | 235 |
| 237 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) | 236 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) |
| 238 DEF_BENCH( return new GrResourceCacheBenchFind(); ) | 237 DEF_BENCH( return new GrResourceCacheBenchFind(); ) |
| 239 | 238 |
| 240 #endif | 239 #endif |
| OLD | NEW |