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

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

Issue 2618633004: Add support for Animated PNG (Closed)
Patch Set: Reject bad data. Cleanups Created 3 years, 10 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/png/PNGImageDecoder.h
diff --git a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h
index a2e3d6810f10712af7a482976a43efc3a9668c38..29f52ac6ff51fe3466d132028b60b8d79549165b 100644
--- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h
@@ -27,12 +27,11 @@
#define PNGImageDecoder_h
#include "platform/image-decoders/ImageDecoder.h"
+#include "platform/image-decoders/png/PNGImageReader.h"
#include <memory>
namespace blink {
-class PNGImageReader;
-
class PLATFORM_EXPORT PNGImageDecoder final : public ImageDecoder {
WTF_MAKE_NONCOPYABLE(PNGImageDecoder);
@@ -45,24 +44,40 @@ class PLATFORM_EXPORT PNGImageDecoder final : public ImageDecoder {
// ImageDecoder:
String filenameExtension() const override { return "png"; }
+ int repetitionCount() const override;
+ bool frameIsCompleteAtIndex(size_t) const override;
+ float frameDurationAtIndex(size_t) const override;
+ bool setFailed() override;
// Callbacks from libpng
void headerAvailable();
void rowAvailable(unsigned char* row, unsigned rowIndex, int);
void complete();
Noel Gordon 2017/02/21 13:53:55 complete -> frameComplete
scroggo_chromium 2017/02/23 22:09:54 Done.
+ // Additional methods used for APNG
Noel Gordon 2017/02/21 13:53:55 Remove this comment.
scroggo_chromium 2017/02/23 22:09:54 Done.
+ void setRepetitionCount(int);
+
private:
Noel Gordon 2017/02/21 13:53:56 private: using ParseQuery = PNGImageReader::Pars
scroggo_chromium 2017/02/23 22:09:54 Done.
// ImageDecoder:
- void decodeSize() override { decode(true); }
- void decode(size_t) override { decode(false); }
+ void decodeSize() override {
Noel Gordon 2017/02/21 13:53:56 Lets move parse() up to here to keep this group to
scroggo_chromium 2017/02/23 22:09:54 Done.
+ parse(PNGImageReader::PNGParseQuery::PNGSizeQuery);
+ }
+ void decode(size_t) override;
+ size_t decodeFrameCount() override;
+ void initializeNewFrame(size_t) override;
+ void clearFrameBuffer(size_t) override;
+ bool onInitFrameBuffer(size_t) override;
+ bool canReusePreviousFrameBuffer(size_t index) const override;
Noel Gordon 2017/02/21 13:53:56 bool canReusePreviousFrameBuffer(size_t) const ove
scroggo_chromium 2017/02/23 22:09:54 Done.
- // Decodes the image. If |onlySize| is true, stops decoding after
- // calculating the image size. If decoding fails but there is no more
- // data coming, sets the "decode failure" flag.
- void decode(bool onlySize);
+ void parse(PNGImageReader::PNGParseQuery);
std::unique_ptr<PNGImageReader> m_reader;
const unsigned m_offset;
+
Noel Gordon 2017/02/21 13:53:55 Remove this empty line.
scroggo_chromium 2017/02/23 22:09:54 Done.
+ size_t m_currentFrame;
+ int m_repetitionCount;
+ bool m_hasAlphaChannel;
+ bool m_currentBufferSawAlpha;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698