| Index: src/codec/SkStreamBuffer.cpp
|
| diff --git a/src/codec/SkStreamBuffer.cpp b/src/codec/SkStreamBuffer.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1e6063706e81145029067f9bcd552b80432daa62
|
| --- /dev/null
|
| +++ b/src/codec/SkStreamBuffer.cpp
|
| @@ -0,0 +1,23 @@
|
| +/*
|
| + * Copyright 2016 Google Inc.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| + */
|
| +
|
| +#include "SkStreamBuffer.h"
|
| +
|
| +SkStreamBuffer::SkStreamBuffer(SkStream* stream)
|
| + : fStream(stream)
|
| + , fBytesBuffered(0)
|
| +{}
|
| +
|
| +size_t SkStreamBuffer::buffer(size_t bytesToBuffer) {
|
| + // FIXME (scroggo): What should we do if the client tries to read too much?
|
| + // Should not be a problem in GIF.
|
| + SkASSERT(fBytesBuffered + bytesToBuffer <= kMaxSize);
|
| +
|
| + const size_t bytesBuffered = fStream->read(fBuffer + fBytesBuffered, bytesToBuffer);
|
| + fBytesBuffered += bytesBuffered;
|
| + return bytesBuffered;
|
| +}
|
|
|