| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef GrGeometryBuffer_DEFINED | 10 #ifndef GrGeometryBuffer_DEFINED |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 *Retrieves whether the buffer was created with the dynamic flag | 25 *Retrieves whether the buffer was created with the dynamic flag |
| 26 * | 26 * |
| 27 * @return true if the buffer was created with the dynamic flag | 27 * @return true if the buffer was created with the dynamic flag |
| 28 */ | 28 */ |
| 29 bool dynamic() const { return fDynamic; } | 29 bool dynamic() const { return fDynamic; } |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * Returns true if the buffer is a wrapper around a CPU array. If true it | 32 * Returns true if the buffer is a wrapper around a CPU array. If true it |
| 33 * indicates that lock will always succeed and will be free. | 33 * indicates that map will always succeed and will be free. |
| 34 */ | 34 */ |
| 35 bool isCPUBacked() const { return fCPUBacked; } | 35 bool isCPUBacked() const { return fCPUBacked; } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Locks the buffer to be written by the CPU. | 38 * Maps the buffer to be written by the CPU. |
| 39 * | 39 * |
| 40 * The previous content of the buffer is invalidated. It is an error | 40 * The previous content of the buffer is invalidated. It is an error |
| 41 * to draw from the buffer while it is locked. It is an error to call lock | 41 * to draw from the buffer while it is mapped. It is an error to call map |
| 42 * on an already locked buffer. It may fail if the backend doesn't support | 42 * on an already mapped buffer. It may fail if the backend doesn't support |
| 43 * locking the buffer. If the buffer is CPU backed then it will always | 43 * mapping the buffer. If the buffer is CPU backed then it will always |
| 44 * succeed and is a free operation. Must be matched by an unlock() call. | 44 * succeed and is a free operation. Must be matched by an unmap() call. |
| 45 * Currently only one lock at a time is supported (no nesting of | 45 * Currently only one map at a time is supported (no nesting of |
| 46 * lock/unlock). | 46 * map/unmap). |
| 47 * | 47 * |
| 48 * @return a pointer to the data or NULL if the lock fails. | 48 * @return a pointer to the data or NULL if the map fails. |
| 49 */ | 49 */ |
| 50 virtual void* lock() = 0; | 50 virtual void* map() = 0; |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * Returns the same ptr that lock() returned at time of lock or NULL if the | 53 * Returns the same ptr that map() returned at time of map or NULL if the |
| 54 * is not locked. | 54 * is not mapped. |
| 55 * | 55 * |
| 56 * @return ptr to locked buffer data or undefined if buffer is not locked. | 56 * @return ptr to mapped buffer data or undefined if buffer is not mapped. |
| 57 */ | 57 */ |
| 58 virtual void* lockPtr() const = 0; | 58 virtual void* mapPtr() const = 0; |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Unlocks the buffer. | 61 * Unmaps the buffer. |
| 62 * | 62 * |
| 63 * The pointer returned by the previous lock call will no longer be valid. | 63 * The pointer returned by the previous map call will no longer be valid. |
| 64 */ | 64 */ |
| 65 virtual void unlock() = 0; | 65 virtual void unmap() = 0; |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 Queries whether the buffer has been locked. | 68 Queries whether the buffer has been mapped. |
| 69 | 69 |
| 70 @return true if the buffer is locked, false otherwise. | 70 @return true if the buffer is mapped, false otherwise. |
| 71 */ | 71 */ |
| 72 virtual bool isLocked() const = 0; | 72 virtual bool isMapped() const = 0; |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * Updates the buffer data. | 75 * Updates the buffer data. |
| 76 * | 76 * |
| 77 * The size of the buffer will be preserved. The src data will be | 77 * The size of the buffer will be preserved. The src data will be |
| 78 * placed at the beginning of the buffer and any remaining contents will | 78 * placed at the beginning of the buffer and any remaining contents will |
| 79 * be undefined. | 79 * be undefined. |
| 80 * | 80 * |
| 81 * @return returns true if the update succeeds, false otherwise. | 81 * @return returns true if the update succeeds, false otherwise. |
| 82 */ | 82 */ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 size_t fGpuMemorySize; | 96 size_t fGpuMemorySize; |
| 97 bool fDynamic; | 97 bool fDynamic; |
| 98 bool fCPUBacked; | 98 bool fCPUBacked; |
| 99 | 99 |
| 100 typedef GrGpuObject INHERITED; | 100 typedef GrGpuObject INHERITED; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 #endif | 103 #endif |
| OLD | NEW |