| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Decodes and scales the specified frame at |index|. The dimensions and | 76 // Decodes and scales the specified frame at |index|. The dimensions and |
| 77 // output format are given in SkImageInfo. Decoded pixels are written into | 77 // output format are given in SkImageInfo. Decoded pixels are written into |
| 78 // |pixels| with a stride of |rowBytes|. Returns true if decoding was | 78 // |pixels| with a stride of |rowBytes|. Returns true if decoding was |
| 79 // successful. | 79 // successful. |
| 80 bool decodeAndScale(SegmentReader*, | 80 bool decodeAndScale(SegmentReader*, |
| 81 bool allDataReceived, | 81 bool allDataReceived, |
| 82 size_t index, | 82 size_t index, |
| 83 const SkImageInfo&, | 83 const SkImageInfo&, |
| 84 void* pixels, | 84 void* pixels, |
| 85 size_t rowBytes); | 85 size_t rowBytes, |
| 86 ImageDecoder::AlphaOption); |
| 86 | 87 |
| 87 // Decodes YUV components directly into the provided memory planes. Must not | 88 // Decodes YUV components directly into the provided memory planes. Must not |
| 88 // be called unless getYUVComponentSizes has been called and returned true. | 89 // be called unless getYUVComponentSizes has been called and returned true. |
| 89 // YUV decoding does not currently support progressive decoding. In order to | 90 // YUV decoding does not currently support progressive decoding. In order to |
| 90 // support it, ImageDecoder needs something analagous to its ImageFrame cache | 91 // support it, ImageDecoder needs something analagous to its ImageFrame cache |
| 91 // to hold partial planes, and the GPU code needs to handle them. | 92 // to hold partial planes, and the GPU code needs to handle them. |
| 92 bool decodeToYUV(SegmentReader*, | 93 bool decodeToYUV(SegmentReader*, |
| 93 size_t index, | 94 size_t index, |
| 94 const SkISize componentSizes[3], | 95 const SkISize componentSizes[3], |
| 95 void* planes[3], | 96 void* planes[3], |
| (...skipping 23 matching lines...) Expand all Loading... |
| 119 void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) { | 120 void setImageDecoderFactory(std::unique_ptr<ImageDecoderFactory> factory) { |
| 120 m_imageDecoderFactory = std::move(factory); | 121 m_imageDecoderFactory = std::move(factory); |
| 121 } | 122 } |
| 122 | 123 |
| 123 void setHasAlpha(size_t index, bool hasAlpha); | 124 void setHasAlpha(size_t index, bool hasAlpha); |
| 124 | 125 |
| 125 SkBitmap tryToResumeDecode(SegmentReader*, | 126 SkBitmap tryToResumeDecode(SegmentReader*, |
| 126 bool allDataReceived, | 127 bool allDataReceived, |
| 127 size_t index, | 128 size_t index, |
| 128 const SkISize& scaledSize, | 129 const SkISize& scaledSize, |
| 129 SkBitmap::Allocator*); | 130 SkBitmap::Allocator*, |
| 131 ImageDecoder::AlphaOption); |
| 130 // This method should only be called while m_decodeMutex is locked. | 132 // This method should only be called while m_decodeMutex is locked. |
| 131 bool decode(SegmentReader*, | 133 bool decode(SegmentReader*, |
| 132 bool allDataReceived, | 134 bool allDataReceived, |
| 133 size_t index, | 135 size_t index, |
| 134 ImageDecoder**, | 136 ImageDecoder**, |
| 135 SkBitmap*, | 137 SkBitmap*, |
| 136 SkBitmap::Allocator*); | 138 SkBitmap::Allocator*, |
| 139 ImageDecoder::AlphaOption); |
| 137 | 140 |
| 138 const SkISize m_fullSize; | 141 const SkISize m_fullSize; |
| 139 | 142 |
| 140 // Parameters used to create internal ImageDecoder objects. | 143 // Parameters used to create internal ImageDecoder objects. |
| 141 const ColorBehavior m_decoderColorBehavior; | 144 const ColorBehavior m_decoderColorBehavior; |
| 142 | 145 |
| 143 const bool m_isMultiFrame; | 146 const bool m_isMultiFrame; |
| 144 bool m_decodeFailed; | 147 bool m_decodeFailed; |
| 145 bool m_yuvDecodingFailed; | 148 bool m_yuvDecodingFailed; |
| 146 size_t m_frameCount; | 149 size_t m_frameCount; |
| 147 Vector<bool> m_hasAlpha; | 150 Vector<bool> m_hasAlpha; |
| 148 | 151 |
| 149 std::unique_ptr<ImageDecoderFactory> m_imageDecoderFactory; | 152 std::unique_ptr<ImageDecoderFactory> m_imageDecoderFactory; |
| 150 | 153 |
| 151 // Prevents multiple decode operations on the same data. | 154 // Prevents multiple decode operations on the same data. |
| 152 Mutex m_decodeMutex; | 155 Mutex m_decodeMutex; |
| 153 | 156 |
| 154 // Protect concurrent access to m_hasAlpha. | 157 // Protect concurrent access to m_hasAlpha. |
| 155 Mutex m_alphaMutex; | 158 Mutex m_alphaMutex; |
| 156 }; | 159 }; |
| 157 | 160 |
| 158 } // namespace blink | 161 } // namespace blink |
| 159 | 162 |
| 160 #endif | 163 #endif |
| OLD | NEW |