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 "GrGLIndexBuffer.h" | 8 #include "GrGLIndexBuffer.h" |
9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 | 10 |
11 GrGLIndexBuffer::GrGLIndexBuffer(GrGpuGL* gpu, const Desc& desc) | 11 GrGLIndexBuffer::GrGLIndexBuffer(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_ELEMENT_ARRAY_BUFFER) { | 13 , fImpl(gpu, desc, GR_GL_ELEMENT_ARRAY_BUFFER) { |
14 } | 14 } |
15 | 15 |
16 void GrGLIndexBuffer::onRelease() { | 16 void GrGLIndexBuffer::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 void GrGLIndexBuffer::onAbandon() { | 24 void GrGLIndexBuffer::onAbandon() { |
25 fImpl.abandon(); | 25 fImpl.abandon(); |
26 INHERITED::onAbandon(); | 26 INHERITED::onAbandon(); |
27 } | 27 } |
28 | 28 |
29 void* GrGLIndexBuffer::map() { | 29 void* GrGLIndexBuffer::onMap() { |
30 if (!this->wasDestroyed()) { | 30 if (!this->wasDestroyed()) { |
31 return fImpl.map(this->getGpuGL()); | 31 return fImpl.map(this->getGpuGL()); |
32 } else { | 32 } else { |
33 return NULL; | 33 return NULL; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 void* GrGLIndexBuffer::mapPtr() const { | 37 void GrGLIndexBuffer::onUnmap() { |
38 return fImpl.mapPtr(); | |
39 } | |
40 | |
41 void GrGLIndexBuffer::unmap() { | |
42 if (!this->wasDestroyed()) { | 38 if (!this->wasDestroyed()) { |
43 fImpl.unmap(this->getGpuGL()); | 39 fImpl.unmap(this->getGpuGL()); |
44 } | 40 } |
45 } | 41 } |
46 | 42 |
47 bool GrGLIndexBuffer::isMapped() const { | 43 bool GrGLIndexBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) { |
48 return fImpl.isMapped(); | |
49 } | |
50 | |
51 bool GrGLIndexBuffer::updateData(const void* src, size_t srcSizeInBytes) { | |
52 if (!this->wasDestroyed()) { | 44 if (!this->wasDestroyed()) { |
53 return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes); | 45 return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes); |
54 } else { | 46 } else { |
55 return false; | 47 return false; |
56 } | 48 } |
57 } | 49 } |
OLD | NEW |