OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 27 matching lines...) Expand all Loading... |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class PLATFORM_EXPORT WEBPImageDecoder final : public ImageDecoder { | 40 class PLATFORM_EXPORT WEBPImageDecoder final : public ImageDecoder { |
41 WTF_MAKE_NONCOPYABLE(WEBPImageDecoder); | 41 WTF_MAKE_NONCOPYABLE(WEBPImageDecoder); |
42 public: | 42 public: |
43 WEBPImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedB
ytes); | 43 WEBPImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedB
ytes); |
44 ~WEBPImageDecoder() override; | 44 ~WEBPImageDecoder() override; |
45 | 45 |
46 // ImageDecoder: | 46 // ImageDecoder: |
47 String filenameExtension() const override { return "webp"; } | 47 String filenameExtension() const override { return "webp"; } |
48 void onSetData(SegmentReader* data) override; | |
49 int repetitionCount() const override; | 48 int repetitionCount() const override; |
50 bool frameIsCompleteAtIndex(size_t) const override; | 49 bool frameIsFullyReceivedAtIndex(size_t) const override; |
51 float frameDurationAtIndex(size_t) const override; | 50 float frameDurationAtIndex(size_t) const override; |
52 size_t clearCacheExceptFrame(size_t) override; | 51 size_t clearCacheExceptFrame(size_t) override; |
53 | 52 |
54 private: | 53 private: |
55 // ImageDecoder: | 54 // ImageDecoder: |
56 virtual void decodeSize() { updateDemuxer(); } | 55 virtual void decodeSize() { updateDemuxer(); } |
57 size_t decodeFrameCount() override; | 56 size_t decodeFrameCount() override; |
58 void initializeNewFrame(size_t) override; | 57 void initializeNewFrame(size_t) override; |
59 void decode(size_t) override; | 58 void decode(size_t) override; |
60 | 59 |
61 bool decodeSingleFrame(const uint8_t* dataBytes, size_t dataSize, size_t fra
meIndex); | 60 bool decodeSingleFrame(const uint8_t* dataBytes, size_t dataSize, size_t fra
meIndex); |
62 | 61 |
63 WebPIDecoder* m_decoder; | 62 WebPIDecoder* m_decoder; |
64 WebPDecBuffer m_decoderBuffer; | 63 WebPDecBuffer m_decoderBuffer; |
65 int m_formatFlags; | 64 int m_formatFlags; |
66 bool m_frameBackgroundHasAlpha; | 65 bool m_frameBackgroundHasAlpha; |
67 | 66 |
68 #if USE(QCMSLIB) | 67 #if USE(QCMSLIB) |
69 void readColorProfile(); | 68 void readColorProfile(); |
70 #endif | 69 #endif |
71 | 70 |
72 bool updateDemuxer(); | 71 bool updateDemuxer(); |
73 bool initFrameBuffer(size_t frameIndex); | 72 bool initFrameBuffer(size_t frameIndex); |
74 void applyPostProcessing(size_t frameIndex); | 73 void applyPostProcessing(size_t frameIndex); |
75 void clearFrameBuffer(size_t frameIndex) override; | 74 void clearFrameBuffer(size_t frameIndex) override; |
76 | 75 |
77 WebPDemuxer* m_demux; | 76 WebPDemuxer* m_demux; |
78 WebPDemuxState m_demuxState; | 77 WebPDemuxState m_demuxState; |
79 bool m_haveAlreadyParsedThisData; | |
80 int m_repetitionCount; | 78 int m_repetitionCount; |
81 int m_decodedHeight; | 79 int m_decodedHeight; |
82 | 80 |
83 typedef void (*AlphaBlendFunction)(ImageFrame&, ImageFrame&, int, int, int); | 81 typedef void (*AlphaBlendFunction)(ImageFrame&, ImageFrame&, int, int, int); |
84 AlphaBlendFunction m_blendFunction; | 82 AlphaBlendFunction m_blendFunction; |
85 | 83 |
86 void clear(); | 84 void clear(); |
87 void clearDecoder(); | 85 void clearDecoder(); |
88 | 86 |
89 // FIXME: Update libwebp's API so it does not require copying the data on ea
ch update. | 87 // FIXME: Update libwebp's API so it does not require copying the data on ea
ch update. |
90 RefPtr<SkData> m_consolidatedData; | 88 RefPtr<SkData> m_consolidatedData; |
91 }; | 89 }; |
92 | 90 |
93 } // namespace blink | 91 } // namespace blink |
94 | 92 |
95 #endif | 93 #endif |
OLD | NEW |