OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #ifndef GrGeometryBuffer_DEFINED | 10 #ifndef GrGeometryBuffer_DEFINED |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 * | 92 * |
93 * @return returns true if the update succeeds, false otherwise. | 93 * @return returns true if the update succeeds, false otherwise. |
94 */ | 94 */ |
95 bool updateData(const void* src, size_t srcSizeInBytes) { | 95 bool updateData(const void* src, size_t srcSizeInBytes) { |
96 SkASSERT(!this->isMapped()); | 96 SkASSERT(!this->isMapped()); |
97 SkASSERT(srcSizeInBytes <= fGpuMemorySize); | 97 SkASSERT(srcSizeInBytes <= fGpuMemorySize); |
98 return this->onUpdateData(src, srcSizeInBytes); | 98 return this->onUpdateData(src, srcSizeInBytes); |
99 } | 99 } |
100 | 100 |
101 protected: | 101 protected: |
102 GrGeometryBuffer(GrGpu* gpu, bool isWrapped, size_t gpuMemorySize, bool dyna
mic, bool cpuBacked) | 102 GrGeometryBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBac
ked) |
103 : INHERITED(gpu, isWrapped) | 103 : INHERITED(gpu, kCached_LifeCycle) |
104 , fMapPtr(NULL) | 104 , fMapPtr(NULL) |
105 , fGpuMemorySize(gpuMemorySize) | 105 , fGpuMemorySize(gpuMemorySize) |
106 , fDynamic(dynamic) | 106 , fDynamic(dynamic) |
107 , fCPUBacked(cpuBacked) {} | 107 , fCPUBacked(cpuBacked) {} |
108 | 108 |
109 private: | 109 private: |
110 virtual size_t onGpuMemorySize() const { return fGpuMemorySize; } | 110 virtual size_t onGpuMemorySize() const { return fGpuMemorySize; } |
111 | 111 |
112 virtual void* onMap() = 0; | 112 virtual void* onMap() = 0; |
113 virtual void onUnmap() = 0; | 113 virtual void onUnmap() = 0; |
114 virtual bool onUpdateData(const void* src, size_t srcSizeInBytes) = 0; | 114 virtual bool onUpdateData(const void* src, size_t srcSizeInBytes) = 0; |
115 | 115 |
116 void* fMapPtr; | 116 void* fMapPtr; |
117 size_t fGpuMemorySize; | 117 size_t fGpuMemorySize; |
118 bool fDynamic; | 118 bool fDynamic; |
119 bool fCPUBacked; | 119 bool fCPUBacked; |
120 | 120 |
121 typedef GrGpuResource INHERITED; | 121 typedef GrGpuResource INHERITED; |
122 }; | 122 }; |
123 | 123 |
124 #endif | 124 #endif |
OLD | NEW |