Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: Source/core/platform/image-decoders/webp/WEBPImageDecoder.h

Issue 13980003: Add animation support for WebP images (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase + Handle transparent frame background Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_ANIMATION_SUPPORT
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() OVERRIDE const { return "webp"; }
Noel Gordon 2013/06/21 05:36:26 s/OVERRIDE//
urvang (Google) 2013/06/24 11:02:03 Done. P.S. It's weird, because both release and d
Xianzhu 2013/06/24 16:20:25 OVERRIDE is defined to nothing for g++ build. It'l
47 virtual bool isSizeAvailable(); 51 virtual bool isSizeAvailable() OVERRIDE;
48 virtual ImageFrame* frameBufferAtIndex(size_t); 52 virtual size_t frameCount() OVERRIDE;
53 virtual ImageFrame* frameBufferAtIndex(size_t) OVERRIDE;
54 #ifdef WEBP_ICC_ANIMATION_SUPPORT
55 virtual void setData(SharedBuffer* data, bool allDataReceived) OVERRIDE;
56 virtual int repetitionCount() const OVERRIDE;
57 virtual bool frameIsCompleteAtIndex(size_t) const OVERRIDE;
58 virtual float frameDurationAtIndex(size_t) const OVERRIDE;
59 virtual size_t clearCacheExceptFrame(size_t) OVERRIDE;
60 #endif
49 61
50 private: 62 private:
51 bool decode(bool onlySize); 63 bool decode(const uint8_t* dataBytes, size_t dataSize, bool onlySize, size_t frameIndex);
52 64
53 WebPIDecoder* m_decoder; 65 WebPIDecoder* m_decoder;
54 WebPDecBuffer m_decoderBuffer; 66 WebPDecBuffer m_decoderBuffer;
55 bool m_hasAlpha;
56 int m_formatFlags; 67 int m_formatFlags;
68 bool m_frameBackgroundHasAlpha;
57 69
58 #ifdef QCMS_WEBP_COLOR_CORRECTION 70 #ifdef QCMS_WEBP_COLOR_CORRECTION
59 qcms_transform* colorTransform() const { return m_transform; } 71 qcms_transform* colorTransform() const { return m_transform; }
60 void createColorTransform(const char* data, size_t); 72 void createColorTransform(const char* data, size_t);
61 void readColorProfile(const uint8_t* data, size_t); 73 void readColorProfile();
62 void applyColorProfile(const uint8_t* data, size_t, ImageFrame&);
63 74
64 bool m_haveReadProfile; 75 bool m_haveReadProfile;
65 qcms_transform* m_transform; 76 qcms_transform* m_transform;
77 #endif
78
79 #ifdef WEBP_ICC_ANIMATION_SUPPORT
80 bool updateDemuxer();
81 bool initFrameBuffer(const WebPIterator&, size_t frameIndex);
82 void applyPostProcessing(size_t frameIndex);
83 virtual void clearFrameBuffer(size_t frameIndex) OVERRIDE;
84
85 WebPDemuxer* m_demux;
86 WebPDemuxState m_demuxState;
87 bool m_haveAlreadyParsedThisData;
88 bool m_haveReadAnimationParameters;
89 int m_repetitionCount;
66 int m_decodedHeight; 90 int m_decodedHeight;
67 #else 91 #else
68 void applyColorProfile(const uint8_t*, size_t, ImageFrame&) { }; 92 void applyPostProcessing(size_t) { };
69 #endif 93 #endif
94
70 void clear(); 95 void clear();
96 void clearDecoder();
71 }; 97 };
72 98
73 } // namespace WebCore 99 } // namespace WebCore
74 100
75 #endif 101 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698