aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkStream.h
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2018-05-08 09:35:32 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-08 20:41:04 +0000
commit8a8a1449526cce423d2e76fb69a8151f49135a5a (patch)
treef56195638549c0f21ba0330008726acd29bbc3c3 /include/core/SkStream.h
parent71a6995084bd493622f4c701db1bf82edb15e062 (diff)
Treat SkFILEStream's fOriginalOffset as the start
Bug: b/78866720 ::rewind() rewinds to fOriginalOffset ::seek(position) seeks to position + fOriginalOffset ::move(offset) will not move < fOriginalOffset ::getPosition() returns position relative to fOriginalOffset ::getLength() returns full size minus fOriginalOffset ::duplicate() and ::fork() pass on fOriginalOffset Android may create an SkFILEStream using a file descriptor whose offset is at the beginning of the data that Android cares about. Treat all positions in SkFILEStream as relative to that original offset. This allows AnimatedImageDrawable to read directly from the SkFILEStream, rather than using an SkFrontBufferedStream and forcing SkGifCodec to cache data for later use. This fixes a TODO that was introduced in https://skia-review.googlesource.com/c/skia/+/9498 and takes it a step further. In that CL, bungeman@ and I discussed the change and decided to "leave this alone for now to avoid changing behavior". Doing a code search today, the only two callers want the new behavior. Change-Id: I9211394d5b730adf528fac0df0af7a664b1295be Reviewed-on: https://skia-review.googlesource.com/126511 Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'include/core/SkStream.h')
-rw-r--r--include/core/SkStream.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index e9e88811f3..75fef125d9 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -289,8 +289,10 @@ public:
*/
explicit SkFILEStream(const char path[] = nullptr);
- /** Initialize the stream with an existing C file stream.
- * The C file stream will be closed in the destructor.
+ /** Initialize the stream with an existing C FILE stream.
+ * The current position of the C FILE stream will be considered the
+ * beginning of the SkFILEStream.
+ * The C FILE stream will be closed in the destructor.
*/
explicit SkFILEStream(FILE* file);