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 #ifndef GrGLIndexBuffer_DEFINED | 8 #ifndef GrGLIndexBuffer_DEFINED |
9 #define GrGLIndexBuffer_DEFINED | 9 #define GrGLIndexBuffer_DEFINED |
10 | 10 |
11 #include "GrIndexBuffer.h" | 11 #include "GrIndexBuffer.h" |
12 #include "GrGLBufferImpl.h" | 12 #include "GrGLBufferImpl.h" |
13 #include "gl/GrGLInterface.h" | 13 #include "gl/GrGLInterface.h" |
14 | 14 |
15 class GrGLGpu; | 15 class GrGLGpu; |
16 | 16 |
17 class GrGLIndexBuffer : public GrIndexBuffer { | 17 class GrGLIndexBuffer : public GrIndexBuffer { |
18 | 18 |
19 public: | 19 public: |
20 typedef GrGLBufferImpl::Desc Desc; | 20 typedef GrGLBufferImpl::Desc Desc; |
21 | 21 |
22 GrGLIndexBuffer(GrGLGpu* gpu, const Desc& desc); | 22 GrGLIndexBuffer(GrGLGpu* gpu, const Desc& desc); |
23 | 23 |
24 GrGLuint bufferID() const { return fImpl.bufferID(); } | 24 GrGLuint bufferID() const { return fImpl.bufferID(); } |
25 size_t baseOffset() const { return fImpl.baseOffset(); } | 25 size_t baseOffset() const { return fImpl.baseOffset(); } |
26 | 26 |
27 void bind() const { | |
28 if (!this->wasDestroyed()) { | |
29 fImpl.bind(this->getGpuGL()); | |
30 } | |
31 } | |
32 | |
33 protected: | 27 protected: |
34 void onAbandon() override; | 28 void onAbandon() override; |
35 void onRelease() override; | 29 void onRelease() override; |
36 void setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, | 30 void setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, |
37 const SkString& dumpName) const override; | 31 const SkString& dumpName) const override; |
38 | 32 |
39 private: | 33 private: |
40 void* onMap() override; | 34 void* onMap() override; |
41 void onUnmap() override; | 35 void onUnmap() override; |
42 bool onUpdateData(const void* src, size_t srcSizeInBytes) override; | 36 bool onUpdateData(const void* src, size_t srcSizeInBytes) override; |
43 | 37 |
44 GrGLGpu* getGpuGL() const { | 38 GrGLGpu* getGpuGL() const { |
45 SkASSERT(!this->wasDestroyed()); | 39 SkASSERT(!this->wasDestroyed()); |
46 return (GrGLGpu*)(this->getGpu()); | 40 return (GrGLGpu*)(this->getGpu()); |
47 } | 41 } |
48 | 42 |
49 GrGLBufferImpl fImpl; | 43 GrGLBufferImpl fImpl; |
50 | 44 |
51 typedef GrIndexBuffer INHERITED; | 45 typedef GrIndexBuffer INHERITED; |
52 }; | 46 }; |
53 | 47 |
54 #endif | 48 #endif |
OLD | NEW |