Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #ifndef WEBPImageDecoder_h | 29 #ifndef WEBPImageDecoder_h |
| 30 #define WEBPImageDecoder_h | 30 #define WEBPImageDecoder_h |
| 31 | 31 |
| 32 #include "core/platform/image-decoders/ImageDecoder.h" | 32 #include "core/platform/image-decoders/ImageDecoder.h" |
| 33 | 33 |
| 34 #include "webp/decode.h" | 34 #include "webp/decode.h" |
| 35 #if USE(QCMSLIB) && (WEBP_DECODER_ABI_VERSION > 0x200) | 35 #if (WEBP_DECODER_ABI_VERSION > 0x200) |
| 36 #include "webp/demux.h" | |
| 37 #define WEBP_ICC_ANIM_SUPPORT | |
|
Noel Gordon
2013/04/29 18:41:57
(avoid abbrevs) Make it WEBP_ANIMIMATION or some s
urvang (Google)
2013/04/30 13:14:15
Done.
Noel Gordon
2013/05/01 17:55:28
WEBP_ICC_ANIMIMATION_SUPPORT -> WEBP_ANIMIMATION_S
urvang (Google)
2013/05/01 22:25:16
This define is to show that libwebp version in use
| |
| 38 #if USE(QCMSLIB) | |
| 36 #define QCMS_WEBP_COLOR_CORRECTION | 39 #define QCMS_WEBP_COLOR_CORRECTION |
| 37 #endif | 40 #endif |
| 41 #endif | |
| 38 | 42 |
| 39 namespace WebCore { | 43 namespace WebCore { |
| 40 | 44 |
| 41 class WEBPImageDecoder : public ImageDecoder { | 45 class WEBPImageDecoder : public ImageDecoder { |
| 42 public: | 46 public: |
| 43 WEBPImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfile Option); | 47 WEBPImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfile Option); |
| 44 virtual ~WEBPImageDecoder(); | 48 virtual ~WEBPImageDecoder(); |
| 45 | 49 |
| 46 virtual String filenameExtension() const { return "webp"; } | 50 virtual String filenameExtension() const { return "webp"; } |
| 47 virtual bool isSizeAvailable(); | 51 virtual bool isSizeAvailable(); |
| 52 virtual size_t frameCount(); | |
| 48 virtual ImageFrame* frameBufferAtIndex(size_t index); | 53 virtual ImageFrame* frameBufferAtIndex(size_t index); |
| 54 #ifdef WEBP_ICC_ANIM_SUPPORT | |
| 55 virtual void setData(SharedBuffer* data, bool allDataReceived); | |
| 56 virtual int repetitionCount() const { return m_repetitionCount; } | |
| 57 virtual void clearFrameBufferCache(size_t clearBeforeFrame); | |
| 58 #endif | |
| 49 | 59 |
| 50 private: | 60 private: |
| 51 bool decode(bool onlySize); | 61 bool decode(const uint8_t* dataBytes, size_t dataSize, bool onlySize, size_t frameIndex); |
| 52 | 62 |
| 53 WebPIDecoder* m_decoder; | 63 WebPIDecoder* m_decoder; |
| 54 WebPDecBuffer m_decoderBuffer; | 64 WebPDecBuffer m_decoderBuffer; |
| 55 bool m_hasAlpha; | |
| 56 int m_formatFlags; | 65 int m_formatFlags; |
| 57 | 66 |
| 58 #ifdef QCMS_WEBP_COLOR_CORRECTION | 67 #ifdef QCMS_WEBP_COLOR_CORRECTION |
| 59 qcms_transform* colorTransform() const { return m_transform; } | 68 qcms_transform* colorTransform() const { return m_transform; } |
| 60 void createColorTransform(const char* data, size_t); | 69 void createColorTransform(const char* data, size_t); |
| 61 void readColorProfile(const uint8_t* data, size_t); | 70 void readColorProfile(); |
| 62 void applyColorProfile(const uint8_t* data, size_t, ImageFrame&); | |
| 63 | 71 |
| 64 bool m_haveReadProfile; | 72 bool m_haveReadProfile; |
| 65 qcms_transform* m_transform; | 73 qcms_transform* m_transform; |
| 74 #endif | |
| 75 | |
| 76 #ifdef WEBP_ICC_ANIM_SUPPORT | |
| 77 // Recreates demux object when new data is available, and sets canvas size, format flags, | |
| 78 // animation properties etc as appropriate. Returns true on success. On | |
| 79 // failure, this will mark the image as failed. | |
| 80 bool updateDemuxer(); | |
| 81 // Called to initialize the frame buffer at the given index based on | |
| 82 // the previous frame's disposal method. Returns true on success. On | |
| 83 // failure, this will mark the image as failed. | |
| 84 bool initFrameBuffer(const WebPIterator& fIter, size_t frameIndex); | |
|
Noel Gordon
2013/04/29 18:41:57
s/ fIter//
urvang (Google)
2013/04/30 13:14:15
What is special about this argument? Why should we
Noel Gordon
2013/05/01 17:55:28
http://www.chromium.org/blink/coding-style
Names 9
| |
| 85 // Apply color profile, and perform necessary post-processing for frame disp osal. | |
| 86 void applyPostProcessing(size_t frameIndex); | |
| 87 | |
| 88 // Number of rows decoded and post-processed so far in the current frame. It | |
| 89 // is used by applyPostProcessing() to decode and post-process incrementally . | |
| 66 int m_decodedHeight; | 90 int m_decodedHeight; |
| 91 | |
| 92 bool m_haveAlreadyParsedThisData; | |
| 93 WebPDemuxer* m_demux; | |
| 94 WebPDemuxState m_demuxState; | |
| 95 | |
| 96 bool m_haveReadAnimParams; | |
| 97 int m_repetitionCount; | |
| 67 #else | 98 #else |
| 68 void applyColorProfile(const uint8_t*, size_t, ImageFrame&) { }; | 99 void applyPostProcessing(size_t) { }; |
| 69 #endif | 100 #endif |
| 70 void clear(); | 101 |
| 102 void clearAll(); | |
|
Noel Gordon
2013/04/29 18:41:57
All what? clear() was fine.
urvang (Google)
2013/04/30 13:14:15
'clear()' was actually renamed to 'clearDecoder()'
| |
| 103 void clearDecoder(); | |
| 71 }; | 104 }; |
| 72 | 105 |
| 73 } // namespace WebCore | 106 } // namespace WebCore |
| 74 | 107 |
| 75 #endif | 108 #endif |
| OLD | NEW |