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

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

Issue 2386453003: WIP: Implement APNG (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 21 matching lines...) Expand all
32 namespace blink { 32 namespace blink {
33 33
34 class PNGImageReader; 34 class PNGImageReader;
35 35
36 class PLATFORM_EXPORT PNGImageDecoder final : public ImageDecoder { 36 class PLATFORM_EXPORT PNGImageDecoder final : public ImageDecoder {
37 WTF_MAKE_NONCOPYABLE(PNGImageDecoder); 37 WTF_MAKE_NONCOPYABLE(PNGImageDecoder);
38 public: 38 public:
39 PNGImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy tes, size_t offset = 0); 39 PNGImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy tes, size_t offset = 0);
40 ~PNGImageDecoder() override; 40 ~PNGImageDecoder() override;
41 41
42 enum class PNGParseQuery { PNGSizeQuery, PNGFrameCountQuery, PNGFrameDataQue ry };
43
42 // ImageDecoder: 44 // ImageDecoder:
43 String filenameExtension() const override { return "png"; } 45 String filenameExtension() const override { return "png"; }
46 size_t decodeFrameCount() override;
47 void parse(PNGParseQuery);
scroggo_chromium 2016/10/04 14:50:16 I think this can be private? (It also does not fit
joostouwerling 2016/10/11 16:31:06 Acknowledged.
44 48
45 // Callbacks from libpng 49 // Callbacks from libpng
50 void frameHeaderAvailable() {};
46 void headerAvailable(); 51 void headerAvailable();
47 void rowAvailable(unsigned char* row, unsigned rowIndex, int); 52 void rowAvailable(unsigned char* row, unsigned rowIndex, int);
48 void complete(); 53 void complete();
49 54
55 // Additional methods used for APNG
56 bool isDecodedFrameCountAvailable() const;
scroggo_chromium 2016/10/04 14:50:16 I think these can be private as well.
joostouwerling 2016/10/11 16:31:06 Acknowledged.
57 void animationControlAvailable(size_t numFrames, size_t numRepetitions);
58
50 private: 59 private:
51 // ImageDecoder: 60 // ImageDecoder:
52 void decodeSize() override { decode(true); } 61 void decodeSize() override { parse(PNGParseQuery::PNGSizeQuery); }
53 void decode(size_t) override { decode(false); } 62 void decode(size_t) override { parse(PNGParseQuery::PNGFrameDataQuery); }
54
55 // Decodes the image. If |onlySize| is true, stops decoding after
56 // calculating the image size. If decoding fails but there is no more
57 // data coming, sets the "decode failure" flag.
58 void decode(bool onlySize);
59 63
60 std::unique_ptr<PNGImageReader> m_reader; 64 std::unique_ptr<PNGImageReader> m_reader;
61 const unsigned m_offset; 65 const unsigned m_offset;
66 bool m_frameCountDecoded;
67 size_t m_frameCount;
62 }; 68 };
63 69
64 } // namespace blink 70 } // namespace blink
65 71
66 #endif 72 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698