| OLD | NEW |
| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 class PLATFORM_EXPORT PNGImageDecoder : public ImageDecoder { | 37 class PLATFORM_EXPORT PNGImageDecoder : public ImageDecoder { |
| 38 WTF_MAKE_NONCOPYABLE(PNGImageDecoder); | 38 WTF_MAKE_NONCOPYABLE(PNGImageDecoder); |
| 39 public: | 39 public: |
| 40 PNGImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy
tes); | 40 PNGImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy
tes); |
| 41 ~PNGImageDecoder() override; | 41 ~PNGImageDecoder() override; |
| 42 | 42 |
| 43 // ImageDecoder: | 43 // ImageDecoder: |
| 44 String filenameExtension() const override { return "png"; } | 44 String filenameExtension() const override { return "png"; } |
| 45 bool hasColorProfile() const override { return m_hasColorProfile; } | 45 bool hasColorProfile() const override { return m_hasColorProfile; } |
| 46 bool frameIsCompleteAtIndex(size_t) const override; |
| 47 float frameDurationAtIndex(size_t) const override; |
| 48 int repetitionCount() const override; |
| 49 size_t clearCacheExceptFrame(size_t) override; |
| 46 | 50 |
| 47 // Callbacks from libpng | 51 // Callbacks from libpng |
| 48 void headerAvailable(); | 52 void headerAvailable(); |
| 49 void rowAvailable(unsigned char* row, unsigned rowIndex, int); | 53 void rowAvailable(unsigned char* row, unsigned rowIndex, int); |
| 50 void complete(); | 54 void complete(); |
| 51 | 55 |
| 52 private: | 56 private: |
| 53 // ImageDecoder: | 57 // ImageDecoder: |
| 54 void decodeSize() override { decode(true); } | 58 void decodeSize() override { parse(); } |
| 55 void decode(size_t) override { decode(false); } | 59 void decode(size_t) override; |
| 60 size_t decodeFrameCount() override; |
| 61 void initializeNewFrame(size_t) override; |
| 56 | 62 |
| 57 // Decodes the image. If |onlySize| is true, stops decoding after | 63 bool initFrameBuffer(); |
| 58 // calculating the image size. If decoding fails but there is no more | 64 bool parse(); |
| 59 // data coming, sets the "decode failure" flag. | |
| 60 void decode(bool onlySize); | |
| 61 | 65 |
| 62 OwnPtr<PNGImageReader> m_reader; | 66 OwnPtr<PNGImageReader> m_reader; |
| 63 bool m_hasColorProfile; | 67 bool m_hasColorProfile; |
| 68 size_t m_currentFrame; |
| 64 }; | 69 }; |
| 65 | 70 |
| 66 } // namespace blink | 71 } // namespace blink |
| 67 | 72 |
| 68 #endif | 73 #endif |
| OLD | NEW |