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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/SegmentStream.h

Issue 2565323003: Move gif image decoder to SkCodec (Closed)
Patch Set: Fix build, mixImagesGif test, and verifyRepetitionCount test Created 3 years, 9 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
Index: third_party/WebKit/Source/platform/image-decoders/SegmentStream.h
diff --git a/third_party/WebKit/Source/platform/image-decoders/SegmentStream.h b/third_party/WebKit/Source/platform/image-decoders/SegmentStream.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e3eb044468a4877716be86fbe389047ce48ad8d
--- /dev/null
+++ b/third_party/WebKit/Source/platform/image-decoders/SegmentStream.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SegmentStream_h
+#define SegmentStream_h
+
+#include <algorithm>
+#include "platform/image-decoders/SegmentReader.h"
+#include "third_party/skia/include/core/SkStream.h"
+#include "wtf/RefPtr.h"
+
+namespace blink {
+
+class SegmentStream : public SkStream {
+ public:
+ SegmentStream();
+ virtual ~SegmentStream() {}
+
+ void setReader(SegmentReader*, bool allContentsReceived);
+ bool isCleared() const { return m_isCleared; }
+
+ // From SkStream:
+ size_t read(void* buffer, size_t) override;
+ size_t peek(void* buffer, size_t) const override;
+ bool isAtEnd() const override { return m_hasReadAllContents; }
+ bool rewind() override {
+ m_position = 0;
+ return true;
+ }
+ bool hasPosition() const override { return true; }
+ size_t getPosition() const override { return m_position; }
+ bool seek(size_t position) override {
+ position = std::min(position, m_reader->size());
+ m_position = position;
+
+ return true;
+ }
+ bool move(long offset) override;
+ bool hasLength() const override { return true; }
+ size_t getLength() const override { return m_reader->size(); }
+
+ private:
+ WTF::RefPtr<SegmentReader> m_reader;
+ size_t m_position;
+ bool m_hasReadAllContents;
+ bool m_isCleared;
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698