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