Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: src/codec/SkStreamBuffer.cpp

Issue 2045293002: Add support for multiple frames in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix a test - we now draw transparent background for missing color table Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkStreamBuffer.h ('k') | src/codec/SkSwizzler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
« no previous file with comments | « src/codec/SkStreamBuffer.h ('k') | src/codec/SkSwizzler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698