reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2010 Google Inc. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | |
| 18 | #ifndef GrGLIndexBuffer_DEFINED |
| 19 | #define GrGLIndexBuffer_DEFINED |
| 20 | |
| 21 | #include "GrIndexBuffer.h" |
| 22 | #include "GrGLConfig.h" |
| 23 | |
| 24 | class GrGpuGL; |
| 25 | |
| 26 | class GrGLIndexBuffer : public GrIndexBuffer { |
| 27 | protected: |
| 28 | GrGLIndexBuffer(GLuint id, |
| 29 | GrGpuGL* gl, |
| 30 | uint32_t sizeInBytes, |
| 31 | bool dynamic); |
| 32 | public: |
| 33 | virtual ~GrGLIndexBuffer(); |
| 34 | |
| 35 | GLuint bufferID() const; |
| 36 | |
| 37 | // overrides of GrIndexBuffer |
| 38 | virtual void abandon(); |
| 39 | virtual void* lock(); |
| 40 | virtual void unlock(); |
| 41 | virtual bool isLocked() const; |
| 42 | virtual bool updateData(const void* src, uint32_t srcSizeInBytes); |
| 43 | private: |
| 44 | GrGpuGL* fGL; |
| 45 | GLuint fBufferID; |
| 46 | void* fLockPtr; |
| 47 | |
| 48 | friend class GrGpuGL; |
| 49 | |
| 50 | typedef GrIndexBuffer INHERITED; |
| 51 | }; |
| 52 | |
| 53 | #endif |