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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 class PLATFORM_EXPORT WEBPImageDecoder final : public ImageDecoder { | 38 class PLATFORM_EXPORT WEBPImageDecoder final : public ImageDecoder { |
39 WTF_MAKE_NONCOPYABLE(WEBPImageDecoder); | 39 WTF_MAKE_NONCOPYABLE(WEBPImageDecoder); |
40 public: | 40 public: |
41 WEBPImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedB
ytes); | 41 WEBPImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedB
ytes); |
42 ~WEBPImageDecoder() override; | 42 ~WEBPImageDecoder() override; |
43 | 43 |
44 // ImageDecoder: | 44 // ImageDecoder: |
45 String filenameExtension() const override { return "webp"; } | 45 String filenameExtension() const override { return "webp"; } |
46 bool hasColorProfile() const override { return m_hasColorProfile; } | 46 bool hasColorProfile() const override { return m_hasColorProfile; } |
| 47 PassRefPtr<ColorSpaceProfile> colorProfile() const override { return m_color
Profile; } |
47 void onSetData(SharedBuffer* data) override; | 48 void onSetData(SharedBuffer* data) override; |
48 int repetitionCount() const override; | 49 int repetitionCount() const override; |
49 bool frameIsCompleteAtIndex(size_t) const override; | 50 bool frameIsCompleteAtIndex(size_t) const override; |
50 float frameDurationAtIndex(size_t) const override; | 51 float frameDurationAtIndex(size_t) const override; |
51 size_t clearCacheExceptFrame(size_t) override; | 52 size_t clearCacheExceptFrame(size_t) override; |
52 | 53 |
53 private: | 54 private: |
54 // ImageDecoder: | 55 // ImageDecoder: |
55 virtual void decodeSize() { updateDemuxer(); } | 56 virtual void decodeSize() { updateDemuxer(); } |
56 size_t decodeFrameCount() override; | 57 size_t decodeFrameCount() override; |
57 void initializeNewFrame(size_t) override; | 58 void initializeNewFrame(size_t) override; |
58 void decode(size_t) override; | 59 void decode(size_t) override; |
59 | 60 |
60 bool decodeSingleFrame(const uint8_t* dataBytes, size_t dataSize, size_t fra
meIndex); | 61 bool decodeSingleFrame(const uint8_t* dataBytes, size_t dataSize, size_t fra
meIndex); |
61 | 62 |
62 WebPIDecoder* m_decoder; | 63 WebPIDecoder* m_decoder; |
63 WebPDecBuffer m_decoderBuffer; | 64 WebPDecBuffer m_decoderBuffer; |
64 int m_formatFlags; | 65 int m_formatFlags; |
65 bool m_frameBackgroundHasAlpha; | 66 bool m_frameBackgroundHasAlpha; |
66 bool m_hasColorProfile; | 67 bool m_hasColorProfile; |
| 68 RefPtr<ColorSpaceProfile> m_colorProfile; |
67 | 69 |
68 #if USE(QCMSLIB) | 70 #if USE(QCMSLIB) |
69 qcms_transform* colorTransform() const { return m_transform; } | 71 qcms_transform* colorTransform() const { return m_transform; } |
70 bool createColorTransform(const char* data, size_t); | 72 PassRefPtr<ColorSpaceProfile> createColorTransform(const char* data, size_t)
; |
71 void clearColorTransform(); | 73 void clearColorTransform(); |
72 void readColorProfile(); | 74 void readColorProfile(); |
73 | 75 |
74 qcms_transform* m_transform; | 76 qcms_transform* m_transform; |
75 #endif | 77 #endif |
76 | 78 |
77 bool updateDemuxer(); | 79 bool updateDemuxer(); |
78 bool initFrameBuffer(size_t frameIndex); | 80 bool initFrameBuffer(size_t frameIndex); |
79 void applyPostProcessing(size_t frameIndex); | 81 void applyPostProcessing(size_t frameIndex); |
80 void clearFrameBuffer(size_t frameIndex) override; | 82 void clearFrameBuffer(size_t frameIndex) override; |
81 | 83 |
82 WebPDemuxer* m_demux; | 84 WebPDemuxer* m_demux; |
83 WebPDemuxState m_demuxState; | 85 WebPDemuxState m_demuxState; |
84 bool m_haveAlreadyParsedThisData; | 86 bool m_haveAlreadyParsedThisData; |
85 int m_repetitionCount; | 87 int m_repetitionCount; |
86 int m_decodedHeight; | 88 int m_decodedHeight; |
87 | 89 |
88 typedef void (*AlphaBlendFunction)(ImageFrame&, ImageFrame&, int, int, int); | 90 typedef void (*AlphaBlendFunction)(ImageFrame&, ImageFrame&, int, int, int); |
89 AlphaBlendFunction m_blendFunction; | 91 AlphaBlendFunction m_blendFunction; |
90 | 92 |
91 void clear(); | 93 void clear(); |
92 void clearDecoder(); | 94 void clearDecoder(); |
93 }; | 95 }; |
94 | 96 |
95 } // namespace blink | 97 } // namespace blink |
96 | 98 |
97 #endif | 99 #endif |
OLD | NEW |