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