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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 bool isMultiFrame() const { return m_isMultiFrame; } | 100 bool isMultiFrame() const { return m_isMultiFrame; } |
101 bool decodeFailed() const { return m_decodeFailed; } | 101 bool decodeFailed() const { return m_decodeFailed; } |
102 | 102 |
103 bool hasAlpha(size_t index); | 103 bool hasAlpha(size_t index); |
104 | 104 |
105 // Must not be called unless the SkROBuffer has all the data. YUV decoding | 105 // Must not be called unless the SkROBuffer has all the data. YUV decoding |
106 // does not currently support progressive decoding. See comment above on | 106 // does not currently support progressive decoding. See comment above on |
107 // decodeToYUV(). | 107 // decodeToYUV(). |
108 bool getYUVComponentSizes(SegmentReader*, SkYUVSizeInfo*); | 108 bool getYUVComponentSizes(SegmentReader*, SkYUVSizeInfo*); |
109 | 109 |
| 110 void setAlphaOption(ImageDecoder::AlphaOption option) { |
| 111 m_alphaOption = option; |
| 112 } |
| 113 |
110 private: | 114 private: |
111 ImageFrameGenerator(const SkISize& fullSize, | 115 ImageFrameGenerator(const SkISize& fullSize, |
112 bool isMultiFrame, | 116 bool isMultiFrame, |
113 const ColorBehavior&); | 117 const ColorBehavior&); |
114 | 118 |
115 friend class ImageFrameGeneratorTest; | 119 friend class ImageFrameGeneratorTest; |
116 friend class DeferredImageDecoderTest; | 120 friend class DeferredImageDecoderTest; |
117 // For testing. |factory| will overwrite the default ImageDecoder creation | 121 // For testing. |factory| will overwrite the default ImageDecoder creation |
118 // logic if |factory->create()| returns non-zero. | 122 // logic if |factory->create()| returns non-zero. |
119 void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) { | 123 void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) { |
(...skipping 18 matching lines...) Expand all Loading... |
138 const SkISize m_fullSize; | 142 const SkISize m_fullSize; |
139 | 143 |
140 // Parameters used to create internal ImageDecoder objects. | 144 // Parameters used to create internal ImageDecoder objects. |
141 const ColorBehavior m_decoderColorBehavior; | 145 const ColorBehavior m_decoderColorBehavior; |
142 | 146 |
143 const bool m_isMultiFrame; | 147 const bool m_isMultiFrame; |
144 bool m_decodeFailed; | 148 bool m_decodeFailed; |
145 bool m_yuvDecodingFailed; | 149 bool m_yuvDecodingFailed; |
146 size_t m_frameCount; | 150 size_t m_frameCount; |
147 Vector<bool> m_hasAlpha; | 151 Vector<bool> m_hasAlpha; |
| 152 ImageDecoder::AlphaOption m_alphaOption; |
148 | 153 |
149 std::unique_ptr<ImageDecoderFactory> m_imageDecoderFactory; | 154 std::unique_ptr<ImageDecoderFactory> m_imageDecoderFactory; |
150 | 155 |
151 // Prevents multiple decode operations on the same data. | 156 // Prevents multiple decode operations on the same data. |
152 Mutex m_decodeMutex; | 157 Mutex m_decodeMutex; |
153 | 158 |
154 // Protect concurrent access to m_hasAlpha. | 159 // Protect concurrent access to m_hasAlpha. |
155 Mutex m_alphaMutex; | 160 Mutex m_alphaMutex; |
156 }; | 161 }; |
157 | 162 |
158 } // namespace blink | 163 } // namespace blink |
159 | 164 |
160 #endif | 165 #endif |
OLD | NEW |