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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 * @return a pointer to the data or NULL if the map fails. | 51 * @return a pointer to the data or NULL if the map fails. |
52 */ | 52 */ |
53 void* map() { return (fMapPtr = this->onMap()); } | 53 void* map() { return (fMapPtr = this->onMap()); } |
54 | 54 |
55 /** | 55 /** |
56 * Unmaps the buffer. | 56 * Unmaps the buffer. |
57 * | 57 * |
58 * The pointer returned by the previous map call will no longer be valid. | 58 * The pointer returned by the previous map call will no longer be valid. |
59 */ | 59 */ |
60 void unmap() { | 60 void unmap() { |
61 SkASSERT(NULL != fMapPtr); | 61 SkASSERT(fMapPtr); |
62 this->onUnmap(); | 62 this->onUnmap(); |
63 fMapPtr = NULL; | 63 fMapPtr = NULL; |
64 } | 64 } |
65 | 65 |
66 /** | 66 /** |
67 * Returns the same ptr that map() returned at time of map or NULL if the | 67 * Returns the same ptr that map() returned at time of map or NULL if the |
68 * is not mapped. | 68 * is not mapped. |
69 * | 69 * |
70 * @return ptr to mapped buffer data or NULL if buffer is not mapped. | 70 * @return ptr to mapped buffer data or NULL if buffer is not mapped. |
71 */ | 71 */ |
72 void* mapPtr() const { return fMapPtr; } | 72 void* mapPtr() const { return fMapPtr; } |
73 | 73 |
74 /** | 74 /** |
75 Queries whether the buffer has been mapped. | 75 Queries whether the buffer has been mapped. |
76 | 76 |
77 @return true if the buffer is mapped, false otherwise. | 77 @return true if the buffer is mapped, false otherwise. |
78 */ | 78 */ |
79 bool isMapped() const { return NULL != fMapPtr; } | 79 bool isMapped() const { return SkToBool(fMapPtr); } |
80 | 80 |
81 /** | 81 /** |
82 * Updates the buffer data. | 82 * Updates the buffer data. |
83 * | 83 * |
84 * The size of the buffer will be preserved. The src data will be | 84 * The size of the buffer will be preserved. The src data will be |
85 * placed at the beginning of the buffer and any remaining contents will | 85 * placed at the beginning of the buffer and any remaining contents will |
86 * be undefined. srcSizeInBytes must be <= to the buffer size. | 86 * be undefined. srcSizeInBytes must be <= to the buffer size. |
87 * | 87 * |
88 * The buffer must not be mapped. | 88 * The buffer must not be mapped. |
89 * | 89 * |
(...skipping 26 matching lines...) Expand all Loading... |
116 | 116 |
117 void* fMapPtr; | 117 void* fMapPtr; |
118 size_t fGpuMemorySize; | 118 size_t fGpuMemorySize; |
119 bool fDynamic; | 119 bool fDynamic; |
120 bool fCPUBacked; | 120 bool fCPUBacked; |
121 | 121 |
122 typedef GrGpuResource INHERITED; | 122 typedef GrGpuResource INHERITED; |
123 }; | 123 }; |
124 | 124 |
125 #endif | 125 #endif |
OLD | NEW |