OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 #include "wtf/Forward.h" | 34 #include "wtf/Forward.h" |
35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 | 37 |
38 class SkImage; | 38 class SkImage; |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class ImageFrameGenerator; | 42 class ImageFrameGenerator; |
43 class SharedBuffer; | 43 class SharedBuffer; |
44 struct FrameData; | 44 struct DeferredFrameData; |
45 | 45 |
46 class PLATFORM_EXPORT DeferredImageDecoder final { | 46 class PLATFORM_EXPORT DeferredImageDecoder final { |
47 WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); | 47 WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); |
48 USING_FAST_MALLOC(DeferredImageDecoder); | 48 USING_FAST_MALLOC(DeferredImageDecoder); |
49 public: | 49 public: |
50 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima
geDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); | 50 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima
geDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); |
51 | 51 |
52 static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec
oder>); | 52 static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec
oder>); |
53 | 53 |
54 ~DeferredImageDecoder(); | 54 ~DeferredImageDecoder(); |
(...skipping 23 matching lines...) Expand all Loading... |
78 | 78 |
79 private: | 79 private: |
80 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); | 80 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); |
81 | 81 |
82 friend class DeferredImageDecoderTest; | 82 friend class DeferredImageDecoderTest; |
83 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } | 83 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } |
84 | 84 |
85 void activateLazyDecoding(); | 85 void activateLazyDecoding(); |
86 void prepareLazyDecodedFrames(); | 86 void prepareLazyDecodedFrames(); |
87 | 87 |
88 PassRefPtr<SkImage> createFrameImageAtIndex(size_t index, bool knownToBeOpaq
ue) const; | 88 PassRefPtr<SkImage> createFrameImageAtIndex(size_t index, bool knownToBeOpaq
ue); |
89 | 89 |
90 // Copy of the data that is passed in, used by deferred decoding. | 90 // Copy of the data that is passed in, used by deferred decoding. |
91 // Allows creating readonly snapshots that may be read in another thread. | 91 // Allows creating readonly snapshots that may be read in another thread. |
92 OwnPtr<SkRWBuffer> m_rwBuffer; | 92 OwnPtr<SkRWBuffer> m_rwBuffer; |
93 bool m_allDataReceived; | 93 bool m_allDataReceived; |
94 OwnPtr<ImageDecoder> m_actualDecoder; | 94 OwnPtr<ImageDecoder> m_actualDecoder; |
95 | 95 |
96 String m_filenameExtension; | 96 String m_filenameExtension; |
97 IntSize m_size; | 97 IntSize m_size; |
98 int m_repetitionCount; | 98 int m_repetitionCount; |
99 bool m_hasColorProfile; | 99 bool m_hasColorProfile; |
100 bool m_canYUVDecode; | 100 bool m_canYUVDecode; |
101 | 101 |
102 // Carries only frame state and other information. Does not carry bitmap. | 102 // Caches frame state information. |
103 Vector<FrameData> m_frameData; | 103 Vector<DeferredFrameData> m_frameData; |
104 RefPtr<ImageFrameGenerator> m_frameGenerator; | 104 RefPtr<ImageFrameGenerator> m_frameGenerator; |
105 | 105 |
106 static bool s_enabled; | 106 static bool s_enabled; |
107 }; | 107 }; |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
110 | 110 |
111 #endif | 111 #endif |
OLD | NEW |