OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "GrGLVertexBuffer.h" | 8 #include "GrGLVertexBuffer.h" |
9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 | 10 |
11 GrGLVertexBuffer::GrGLVertexBuffer(GrGpuGL* gpu, const Desc& desc) | 11 GrGLVertexBuffer::GrGLVertexBuffer(GrGpuGL* gpu, const Desc& desc) |
12 : INHERITED(gpu, desc.fIsWrapped, desc.fSizeInBytes, desc.fDynamic, 0 == des
c.fID) | 12 : INHERITED(gpu, desc.fIsWrapped, desc.fSizeInBytes, desc.fDynamic, 0 == des
c.fID) |
13 , fImpl(gpu, desc, GR_GL_ARRAY_BUFFER) { | 13 , fImpl(gpu, desc, GR_GL_ARRAY_BUFFER) { |
14 } | 14 } |
15 | 15 |
16 void GrGLVertexBuffer::onRelease() { | 16 void GrGLVertexBuffer::onRelease() { |
17 if (!this->wasDestroyed()) { | 17 if (!this->wasDestroyed()) { |
18 fImpl.release(this->getGpuGL()); | 18 fImpl.release(this->getGpuGL()); |
19 } | 19 } |
20 | 20 |
21 INHERITED::onRelease(); | 21 INHERITED::onRelease(); |
22 } | 22 } |
23 | 23 |
24 | |
25 void GrGLVertexBuffer::onAbandon() { | 24 void GrGLVertexBuffer::onAbandon() { |
26 fImpl.abandon(); | 25 fImpl.abandon(); |
27 INHERITED::onAbandon(); | 26 INHERITED::onAbandon(); |
28 } | 27 } |
29 | 28 |
30 void* GrGLVertexBuffer::map() { | 29 void* GrGLVertexBuffer::onMap() { |
31 if (!this->wasDestroyed()) { | 30 if (!this->wasDestroyed()) { |
32 return fImpl.map(this->getGpuGL()); | 31 return fImpl.map(this->getGpuGL()); |
33 } else { | 32 } else { |
34 return NULL; | 33 return NULL; |
35 } | 34 } |
36 } | 35 } |
37 | 36 |
38 void* GrGLVertexBuffer::mapPtr() const { | 37 void GrGLVertexBuffer::onUnmap() { |
39 return fImpl.mapPtr(); | |
40 } | |
41 | |
42 void GrGLVertexBuffer::unmap() { | |
43 if (!this->wasDestroyed()) { | 38 if (!this->wasDestroyed()) { |
44 fImpl.unmap(this->getGpuGL()); | 39 fImpl.unmap(this->getGpuGL()); |
45 } | 40 } |
46 } | 41 } |
47 | 42 |
48 bool GrGLVertexBuffer::isMapped() const { | 43 bool GrGLVertexBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) { |
49 return fImpl.isMapped(); | |
50 } | |
51 | |
52 bool GrGLVertexBuffer::updateData(const void* src, size_t srcSizeInBytes) { | |
53 if (!this->wasDestroyed()) { | 44 if (!this->wasDestroyed()) { |
54 return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes); | 45 return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes); |
55 } else { | 46 } else { |
56 return false; | 47 return false; |
57 } | 48 } |
58 } | 49 } |
OLD | NEW |