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

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

Issue 2386453003: WIP: Implement APNG (Closed)
Patch Set: Extra tests for invalid images; new image for animation tests 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 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 c0c9ca872b0ab94e8fb7bf03370a5c2441ca247f..43de7ca502148bf013193432a0fff5d1b8a51125 100644
--- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h
@@ -39,26 +39,38 @@ public:
PNGImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBytes, size_t offset = 0);
~PNGImageDecoder() override;
+ enum class PNGParseQuery { PNGSizeQuery, PNGMetaDataQuery };
+
// ImageDecoder:
String filenameExtension() const override { return "png"; }
+ int repetitionCount() const override;
// Callbacks from libpng
void headerAvailable();
void rowAvailable(unsigned char* row, unsigned rowIndex, int);
void complete();
+ // Additional methods used for APNG
+ void setRepetitionCount(size_t);
+ // This is called by PNGImageReader when it encounters the IEND chunk
+ // while parsing PNGMetaDataQuery. If m_metaDataDecoded is true, the decoder
+ // does not need to query for meta data again.
+ void setMetaDataDecoded() { m_metaDataDecoded = true; };
cblume 2016/10/15 00:30:50 These two methods are public because they get call
scroggo_chromium 2016/10/17 13:24:00 A similar suggestion came up crrev.com/2045293002
cblume 2016/10/17 17:08:16 Okay, I agree. I definitely agree that I dislike
+
private:
// ImageDecoder:
- void decodeSize() override { decode(true); }
- void decode(size_t) override { decode(false); }
+ void decodeSize() override { parse(PNGParseQuery::PNGSizeQuery); }
+ void decode(size_t) override;
+ size_t decodeFrameCount() override;
+ void initializeNewFrame(size_t) override;
- // 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(PNGParseQuery);
std::unique_ptr<PNGImageReader> m_reader;
const unsigned m_offset;
+ bool m_metaDataDecoded;
+ size_t m_frameCount;
+ int m_repetitionCount;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698