OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkStreamBuffer.h" |
| 9 |
| 10 SkStreamBuffer::SkStreamBuffer(SkStream* stream) |
| 11 : fStream(stream) |
| 12 , fBytesBuffered(0) |
| 13 {} |
| 14 |
| 15 size_t SkStreamBuffer::buffer(size_t bytesToBuffer) { |
| 16 // FIXME (scroggo): What should we do if the client tries to read too much? |
| 17 // Should not be a problem in GIF. |
| 18 SkASSERT(fBytesBuffered + bytesToBuffer <= kMaxSize); |
| 19 |
| 20 const size_t bytesBuffered = fStream->read(fBuffer + fBytesBuffered, bytesTo
Buffer); |
| 21 fBytesBuffered += bytesBuffered; |
| 22 return bytesBuffered; |
| 23 } |
OLD | NEW |