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

Side by Side Diff: Source/core/platform/graphics/chromium/DeferredImageDecoder.h

Issue 19838002: Reland change to enable deferred image decoding for animated GIFs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: merved Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef DeferredImageDecoder_h 26 #ifndef DeferredImageDecoder_h
27 #define DeferredImageDecoder_h 27 #define DeferredImageDecoder_h
28 28
29 #include "SkBitmap.h" 29 #include "SkBitmap.h"
30 #include "core/platform/graphics/ImageSource.h" 30 #include "core/platform/graphics/ImageSource.h"
31 #include "core/platform/graphics/IntSize.h" 31 #include "core/platform/graphics/IntSize.h"
32 #include "core/platform/image-decoders/ImageDecoder.h" 32 #include "core/platform/image-decoders/ImageDecoder.h"
33 #include <wtf/Forward.h> 33 #include "wtf/Forward.h"
34 #include "wtf/OwnPtr.h"
35 #include "wtf/Vector.h"
34 36
35 namespace WebCore { 37 namespace WebCore {
36 38
37 class ImageFrameGenerator; 39 class ImageFrameGenerator;
38 class SharedBuffer; 40 class SharedBuffer;
39 41
40 class DeferredImageDecoder { 42 class DeferredImageDecoder {
41 public: 43 public:
42 ~DeferredImageDecoder(); 44 ~DeferredImageDecoder();
43 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima geSource::AlphaOption, ImageSource::GammaAndColorProfileOption); 45 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima geSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
(...skipping 20 matching lines...) Expand all
64 size_t clearCacheExceptFrame(size_t); 66 size_t clearCacheExceptFrame(size_t);
65 bool frameHasAlphaAtIndex(size_t index) const; 67 bool frameHasAlphaAtIndex(size_t index) const;
66 bool frameIsCompleteAtIndex(size_t) const; 68 bool frameIsCompleteAtIndex(size_t) const;
67 float frameDurationAtIndex(size_t) const; 69 float frameDurationAtIndex(size_t) const;
68 unsigned frameBytesAtIndex(size_t index) const; 70 unsigned frameBytesAtIndex(size_t index) const;
69 ImageOrientation orientation() const; 71 ImageOrientation orientation() const;
70 bool hotSpot(IntPoint&) const; 72 bool hotSpot(IntPoint&) const;
71 73
72 private: 74 private:
73 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); 75 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder);
74 SkBitmap createLazyDecodingBitmap(); 76 void prepareLazyDecodedFrames();
77 SkBitmap createLazyDecodingBitmap(size_t index);
78 void activateLazyDecoding();
75 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); 79 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived);
76 80
77 RefPtr<SharedBuffer> m_data; 81 RefPtr<SharedBuffer> m_data;
78 bool m_allDataReceived; 82 bool m_allDataReceived;
79 OwnPtr<ImageDecoder> m_actualDecoder; 83 OwnPtr<ImageDecoder> m_actualDecoder;
80 84
81 String m_filenameExtension; 85 String m_filenameExtension;
82 IntSize m_size; 86 IntSize m_size;
83 ImageOrientation m_orientation; 87 ImageOrientation m_orientation;
88 int m_repetitionCount;
84 89
85 ImageFrame m_lazyDecodedFrame; 90 Vector<OwnPtr<ImageFrame> > m_lazyDecodedFrames;
86 RefPtr<ImageFrameGenerator> m_frameGenerator; 91 RefPtr<ImageFrameGenerator> m_frameGenerator;
87 92
88 static bool s_enabled; 93 static bool s_enabled;
89 }; 94 };
90 95
91 } // namespace WebCore 96 } // namespace WebCore
92 97
93 #endif 98 #endif
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/core/platform/graphics/chromium/DeferredImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698