add helper available()
git-svn-id: http://skia.googlecode.com/svn/trunk@1188 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
bb6992a9d6
commit
5b3d5349be
@ -43,6 +43,10 @@ public:
|
||||
bool eof() const { return fCurr >= fStop; }
|
||||
const void* base() const { return fBase; }
|
||||
const void* peek() const { return fCurr; }
|
||||
|
||||
uint32_t available() const { return fStop - fCurr; }
|
||||
bool isAvailable(uint32_t size) const { return fCurr + size <= fStop; }
|
||||
|
||||
void rewind() { fCurr = fBase; }
|
||||
|
||||
void setOffset(size_t offset) {
|
||||
|
@ -70,6 +70,14 @@ public:
|
||||
|
||||
// write count bytes (must be a multiple of 4)
|
||||
void writeMul4(const void* values, size_t size) {
|
||||
this->write(values, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write size bytes from values. size must be a multiple of 4, though
|
||||
* values need not be 4-byte aligned.
|
||||
*/
|
||||
void write(const void* values, size_t size) {
|
||||
SkASSERT(SkAlign4(size) == size);
|
||||
// if we could query how much is avail in the current block, we might
|
||||
// copy that much, and then alloc the rest. That would reduce the waste
|
||||
|
Loading…
Reference in New Issue
Block a user