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 | 9 |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 * Retrieves the maximum number of quads that could be rendered | 29 * Retrieves the maximum number of quads that could be rendered |
30 * from the index buffer (using kTriangles_GrPrimitiveType). | 30 * from the index buffer (using kTriangles_GrPrimitiveType). |
31 * @return the maximum number of quads using full size of index buffer. | 31 * @return the maximum number of quads using full size of index buffer. |
32 */ | 32 */ |
33 int maxQuads() const { | 33 int maxQuads() const { |
34 return static_cast<int>(this->gpuMemorySize() / (sizeof(uint16_t) * 6)); | 34 return static_cast<int>(this->gpuMemorySize() / (sizeof(uint16_t) * 6)); |
35 } | 35 } |
36 protected: | 36 protected: |
37 GrIndexBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBacked
) | 37 GrIndexBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBacked
) |
38 : INHERITED(gpu, gpuMemorySize, dynamic, cpuBacked) { | 38 : INHERITED(gpu, gpuMemorySize, dynamic, cpuBacked) { |
39 GrScratchKey key; | 39 // We currently only make buffers scratch if they're both pow2 sized and
not cpuBacked. |
40 ComputeScratchKey(gpuMemorySize, dynamic, &key); | 40 if (!cpuBacked && SkIsPow2(gpuMemorySize)) { |
41 this->setScratchKey(key); | 41 GrScratchKey key; |
| 42 ComputeScratchKey(gpuMemorySize, dynamic, &key); |
| 43 this->setScratchKey(key); |
| 44 } |
42 } | 45 } |
43 | 46 |
44 private: | 47 private: |
45 typedef GrGeometryBuffer INHERITED; | 48 typedef GrGeometryBuffer INHERITED; |
46 }; | 49 }; |
47 | 50 |
48 #endif | 51 #endif |
OLD | NEW |