| 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 |
| 11 #define GrGeometryBuffer_DEFINED | 11 #define GrGeometryBuffer_DEFINED |
| 12 | 12 |
| 13 #include "GrGpuObject.h" | 13 #include "GrGpuResource.h" |
| 14 | 14 |
| 15 class GrGpu; | 15 class GrGpu; |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * Parent class for vertex and index buffers | 18 * Parent class for vertex and index buffers |
| 19 */ | 19 */ |
| 20 class GrGeometryBuffer : public GrGpuObject { | 20 class GrGeometryBuffer : public GrGpuResource { |
| 21 public: | 21 public: |
| 22 SK_DECLARE_INST_COUNT(GrGeometryBuffer); | 22 SK_DECLARE_INST_COUNT(GrGeometryBuffer); |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 *Retrieves whether the buffer was created with the dynamic flag | 25 *Retrieves whether the buffer was created with the dynamic flag |
| 26 * | 26 * |
| 27 * @return true if the buffer was created with the dynamic flag | 27 * @return true if the buffer was created with the dynamic flag |
| 28 */ | 28 */ |
| 29 bool dynamic() const { return fDynamic; } | 29 bool dynamic() const { return fDynamic; } |
| 30 | 30 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 * not serialized with other operations. | 91 * not serialized with other operations. |
| 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 // GrGpuObject overrides | 101 // GrGpuResource overrides |
| 102 virtual size_t gpuMemorySize() const { return fGpuMemorySize; } | 102 virtual size_t gpuMemorySize() const { return fGpuMemorySize; } |
| 103 | 103 |
| 104 protected: | 104 protected: |
| 105 GrGeometryBuffer(GrGpu* gpu, bool isWrapped, size_t gpuMemorySize, bool dyna
mic, bool cpuBacked) | 105 GrGeometryBuffer(GrGpu* gpu, bool isWrapped, size_t gpuMemorySize, bool dyna
mic, bool cpuBacked) |
| 106 : INHERITED(gpu, isWrapped) | 106 : INHERITED(gpu, isWrapped) |
| 107 , fMapPtr(NULL) | 107 , fMapPtr(NULL) |
| 108 , fGpuMemorySize(gpuMemorySize) | 108 , fGpuMemorySize(gpuMemorySize) |
| 109 , fDynamic(dynamic) | 109 , fDynamic(dynamic) |
| 110 , fCPUBacked(cpuBacked) {} | 110 , fCPUBacked(cpuBacked) {} |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 virtual void* onMap() = 0; | 113 virtual void* onMap() = 0; |
| 114 virtual void onUnmap() = 0; | 114 virtual void onUnmap() = 0; |
| 115 virtual bool onUpdateData(const void* src, size_t srcSizeInBytes) = 0; | 115 virtual bool onUpdateData(const void* src, size_t srcSizeInBytes) = 0; |
| 116 | 116 |
| 117 void* fMapPtr; | 117 void* fMapPtr; |
| 118 size_t fGpuMemorySize; | 118 size_t fGpuMemorySize; |
| 119 bool fDynamic; | 119 bool fDynamic; |
| 120 bool fCPUBacked; | 120 bool fCPUBacked; |
| 121 | 121 |
| 122 typedef GrGpuObject INHERITED; | 122 typedef GrGpuResource INHERITED; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 #endif | 125 #endif |
| OLD | NEW |