| 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 |
| 11 #ifndef GrVertexBuffer_DEFINED | 11 #ifndef GrVertexBuffer_DEFINED |
| 12 #define GrVertexBuffer_DEFINED | 12 #define GrVertexBuffer_DEFINED |
| 13 | 13 |
| 14 #include "GrGeometryBuffer.h" | 14 #include "GrGeometryBuffer.h" |
| 15 | 15 |
| 16 class GrVertexBuffer : public GrGeometryBuffer { | 16 class GrVertexBuffer : public GrGeometryBuffer { |
| 17 public: |
| 18 static void ComputeScratchKey(size_t size, bool dynamic, GrScratchKey* key)
{ |
| 19 static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateRe
sourceType(); |
| 20 |
| 21 GrScratchKey::Builder builder(key, kType, 2); |
| 22 |
| 23 SkASSERT(size <= SK_MaxU32); |
| 24 builder[0] = size; |
| 25 builder[1] = dynamic ? 1 : 0; |
| 26 } |
| 27 |
| 17 protected: | 28 protected: |
| 18 GrVertexBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBacke
d) | 29 GrVertexBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBacke
d) |
| 19 : INHERITED(gpu, gpuMemorySize, dynamic, cpuBacked) {} | 30 : INHERITED(gpu, gpuMemorySize, dynamic, cpuBacked) { |
| 31 GrScratchKey key; |
| 32 ComputeScratchKey(gpuMemorySize, dynamic, &key); |
| 33 this->setScratchKey(key); |
| 34 } |
| 35 |
| 20 private: | 36 private: |
| 21 typedef GrGeometryBuffer INHERITED; | 37 typedef GrGeometryBuffer INHERITED; |
| 22 }; | 38 }; |
| 23 | 39 |
| 24 #endif | 40 #endif |
| OLD | NEW |