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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 private: | 92 private: |
93 ImageFrameGenerator(const SkISize& fullSize, bool isMultiFrame); | 93 ImageFrameGenerator(const SkISize& fullSize, bool isMultiFrame); |
94 | 94 |
95 friend class ImageFrameGeneratorTest; | 95 friend class ImageFrameGeneratorTest; |
96 friend class DeferredImageDecoderTest; | 96 friend class DeferredImageDecoderTest; |
97 // For testing. |factory| will overwrite the default ImageDecoder creation l
ogic if |factory->create()| returns non-zero. | 97 // For testing. |factory| will overwrite the default ImageDecoder creation l
ogic if |factory->create()| returns non-zero. |
98 void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) {
m_imageDecoderFactory = std::move(factory); } | 98 void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) {
m_imageDecoderFactory = std::move(factory); } |
99 | 99 |
100 void setHasAlpha(size_t index, bool hasAlpha); | 100 void setHasAlpha(size_t index, bool hasAlpha); |
101 | 101 |
102 SkBitmap tryToResumeDecode(SegmentReader*, bool allDataReceived, size_t inde
x, const SkISize& scaledSize, SkBitmap::Allocator*); | 102 SkBitmap tryToResumeDecode(SegmentReader*, bool allDataReceived, size_t inde
x, const SkISize& scaledSize, sk_sp<SkBitmap::Allocator>); |
103 // This method should only be called while m_decodeMutex is locked. | 103 // This method should only be called while m_decodeMutex is locked. |
104 bool decode(SegmentReader*, bool allDataReceived, size_t index, ImageDecoder
**, SkBitmap*, SkBitmap::Allocator*); | 104 bool decode(SegmentReader*, bool allDataReceived, size_t index, ImageDecoder
**, SkBitmap*, sk_sp<SkBitmap::Allocator>); |
105 | 105 |
106 const SkISize m_fullSize; | 106 const SkISize m_fullSize; |
107 | 107 |
108 const bool m_isMultiFrame; | 108 const bool m_isMultiFrame; |
109 bool m_decodeFailed; | 109 bool m_decodeFailed; |
110 bool m_yuvDecodingFailed; | 110 bool m_yuvDecodingFailed; |
111 size_t m_frameCount; | 111 size_t m_frameCount; |
112 Vector<bool> m_hasAlpha; | 112 Vector<bool> m_hasAlpha; |
113 | 113 |
114 std::unique_ptr<ImageDecoderFactory> m_imageDecoderFactory; | 114 std::unique_ptr<ImageDecoderFactory> m_imageDecoderFactory; |
115 | 115 |
116 // Prevents multiple decode operations on the same data. | 116 // Prevents multiple decode operations on the same data. |
117 Mutex m_decodeMutex; | 117 Mutex m_decodeMutex; |
118 | 118 |
119 // Protect concurrent access to m_hasAlpha. | 119 // Protect concurrent access to m_hasAlpha. |
120 Mutex m_alphaMutex; | 120 Mutex m_alphaMutex; |
121 }; | 121 }; |
122 | 122 |
123 } // namespace blink | 123 } // namespace blink |
124 | 124 |
125 #endif | 125 #endif |
OLD | NEW |