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