| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrGLBufferImpl_DEFINED | 8 #ifndef GrGLBufferImpl_DEFINED |
| 9 #define GrGLBufferImpl_DEFINED | 9 #define GrGLBufferImpl_DEFINED |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 ~GrGLBufferImpl() { | 39 ~GrGLBufferImpl() { |
| 40 // either release or abandon should have been called by the owner of thi
s object. | 40 // either release or abandon should have been called by the owner of thi
s object. |
| 41 SkASSERT(0 == fDesc.fID); | 41 SkASSERT(0 == fDesc.fID); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void abandon(); | 44 void abandon(); |
| 45 void release(GrGLGpu* gpu); | 45 void release(GrGLGpu* gpu); |
| 46 | 46 |
| 47 GrGLuint bufferID() const { return fDesc.fID; } | 47 GrGLuint bufferID() const { return fDesc.fID; } |
| 48 size_t baseOffset() const { return reinterpret_cast<size_t>(fCPUData); } | 48 size_t baseOffset() const { return reinterpret_cast<size_t>(fCPUData); } |
| 49 GrGLenum bufferType() const { return fBufferType; } |
| 49 | 50 |
| 50 void* map(GrGLGpu* gpu); | 51 void* map(GrGLGpu* gpu); |
| 51 void unmap(GrGLGpu* gpu); | 52 void unmap(GrGLGpu* gpu); |
| 52 bool isMapped() const; | 53 bool isMapped() const; |
| 53 bool updateData(GrGLGpu* gpu, const void* src, size_t srcSizeInBytes); | 54 bool updateData(GrGLGpu* gpu, const void* src, size_t srcSizeInBytes); |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 void validate() const; | 57 void validate() const; |
| 57 | 58 |
| 58 Desc fDesc; | 59 Desc fDesc; |
| 59 GrGLenum fBufferType; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER | 60 GrGLenum fBufferType; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER, e.g
. |
| 60 void* fCPUData; | 61 void* fCPUData; |
| 61 void* fMapPtr; | 62 void* fMapPtr; |
| 62 size_t fGLSizeInBytes; // In certain cases we make the size of the
GL buffer object | 63 size_t fGLSizeInBytes; // In certain cases we make the size of the
GL buffer object |
| 63 // smaller or larger than the size in fDesc
. | 64 // smaller or larger than the size in fDesc
. |
| 64 | 65 |
| 65 typedef SkNoncopyable INHERITED; | 66 typedef SkNoncopyable INHERITED; |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 #endif | 69 #endif |
| OLD | NEW |