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

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

Issue 2565323003: Move gif image decoder to SkCodec (Closed)
Patch Set: Clarify code with mo'bettah comments Created 3 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SegmentStream_h
6 #define SegmentStream_h
7
8 #include <algorithm>
9 #include "platform/image-decoders/SegmentReader.h"
10 #include "platform/wtf/RefPtr.h"
11 #include "third_party/skia/include/core/SkStream.h"
12
13 namespace blink {
14
15 class PLATFORM_EXPORT SegmentStream : public SkStream {
16 public:
17 SegmentStream();
18 SegmentStream(SegmentStream&& rhs);
19 virtual ~SegmentStream() {}
20
21 SegmentStream& operator=(SegmentStream&& rhs);
22
23 void SetReader(WTF::PassRefPtr<SegmentReader>);
24 bool IsCleared() const { return is_cleared_; }
scroggo_chromium 2017/07/18 21:10:09 Add a comment describing what this means?
cblume 2017/07/19 23:27:04 Done.
25
26 // From SkStream:
27 size_t read(void* buffer, size_t) override;
28 size_t peek(void* buffer, size_t) const override;
29 bool isAtEnd() const override { return has_read_all_contents_; }
30 bool rewind() override;
31 bool hasPosition() const override { return true; }
32 size_t getPosition() const override { return position_; }
33 bool seek(size_t position) override;
34 bool move(long offset) override;
35 bool hasLength() const override { return true; }
36 size_t getLength() const override {
37 if (reader_)
38 return reader_->size();
39
40 return 0;
41 }
42
43 private:
44 void SetPositionState(size_t new_position);
45
46 WTF::RefPtr<SegmentReader> reader_;
47 size_t position_ = 0;
48 bool has_read_all_contents_ = true;
49 bool is_cleared_ = true;
50 };
51
52 } // namespace blink
53
54 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698