diff options
-rw-r--r-- | src/gpu/GrAllocator.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gpu/GrAllocator.h b/src/gpu/GrAllocator.h index e5d2f4ea61..314e58a99a 100644 --- a/src/gpu/GrAllocator.h +++ b/src/gpu/GrAllocator.h @@ -110,6 +110,24 @@ public: bool empty() const { return 0 == fCount; } /** + * Access first item, only call if count() != 0 + */ + void* front() { + SkASSERT(fCount); + SkASSERT(fInsertionIndexInBlock > 0); + return (char*)(fBlocks.front()); + } + + /** + * Access first item, only call if count() != 0 + */ + const void* front() const { + SkASSERT(fCount); + SkASSERT(fInsertionIndexInBlock > 0); + return (const char*)(fBlocks.front()); + } + + /** * Access last item, only call if count() != 0 */ void* back() { @@ -297,6 +315,20 @@ public: bool empty() const { return fAllocator.empty(); } /** + * Access first item, only call if count() != 0 + */ + T& front() { + return *(T*)fAllocator.front(); + } + + /** + * Access first item, only call if count() != 0 + */ + const T& front() const { + return *(T*)fAllocator.front(); + } + + /** * Access last item, only call if count() != 0 */ T& back() { |