| Index: src/core/SkWriter32.cpp
|
| diff --git a/src/core/SkWriter32.cpp b/src/core/SkWriter32.cpp
|
| index 5e89ed655b70e5d83da4df2588704689898b52e6..07a43d782123b8bfb70ec34fb2a48f8a437eea01 100644
|
| --- a/src/core/SkWriter32.cpp
|
| +++ b/src/core/SkWriter32.cpp
|
| @@ -66,3 +66,18 @@ size_t SkWriter32::WriteStringSize(const char* str, size_t len) {
|
| // add 1 since we also write a terminating 0
|
| return SkAlign4(lenBytes + len + 1);
|
| }
|
| +
|
| +void SkWriter32::grow(size_t size) {
|
| + bool wasExternal = (fExternal != NULL) && (fData == fExternal);
|
| + // cause the buffer to grow
|
| + fInternal.setCount(size);
|
| + fData = fInternal.begin();
|
| + if (wasExternal) {
|
| + // we were external, so copy in the data
|
| + memcpy(fData, fExternal, fUsed);
|
| + }
|
| + // read the grown capacity
|
| + fCapacity = fInternal.reserved();
|
| + // expand the buffer to it's full capacity
|
| + fInternal.setCount(fCapacity);
|
| +}
|
|
|