| 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 all_data_received, | 81 bool all_data_received, |
| 82 size_t index, | 82 size_t index, |
| 83 const SkImageInfo&, | 83 const SkImageInfo&, |
| 84 void* pixels, | 84 void* pixels, |
| 85 size_t row_bytes); | 85 size_t row_bytes, |
| 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 component_sizes[3], | 95 const SkISize component_sizes[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 image_decoder_factory_ = std::move(factory); | 121 image_decoder_factory_ = std::move(factory); |
| 121 } | 122 } |
| 122 | 123 |
| 123 void SetHasAlpha(size_t index, bool has_alpha); | 124 void SetHasAlpha(size_t index, bool has_alpha); |
| 124 | 125 |
| 125 SkBitmap TryToResumeDecode(SegmentReader*, | 126 SkBitmap TryToResumeDecode(SegmentReader*, |
| 126 bool all_data_received, | 127 bool all_data_received, |
| 127 size_t index, | 128 size_t index, |
| 128 const SkISize& scaled_size, | 129 const SkISize& scaled_size, |
| 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 all_data_received, | 134 bool all_data_received, |
| 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 full_size_; | 141 const SkISize full_size_; |
| 139 | 142 |
| 140 // Parameters used to create internal ImageDecoder objects. | 143 // Parameters used to create internal ImageDecoder objects. |
| 141 const ColorBehavior decoder_color_behavior_; | 144 const ColorBehavior decoder_color_behavior_; |
| 142 | 145 |
| 143 const bool is_multi_frame_; | 146 const bool is_multi_frame_; |
| 144 bool decode_failed_; | 147 bool decode_failed_; |
| 145 bool yuv_decoding_failed_; | 148 bool yuv_decoding_failed_; |
| 146 size_t frame_count_; | 149 size_t frame_count_; |
| 147 Vector<bool> has_alpha_; | 150 Vector<bool> has_alpha_; |
| 148 | 151 |
| 149 std::unique_ptr<ImageDecoderFactory> image_decoder_factory_; | 152 std::unique_ptr<ImageDecoderFactory> image_decoder_factory_; |
| 150 | 153 |
| 151 // Prevents multiple decode operations on the same data. | 154 // Prevents multiple decode operations on the same data. |
| 152 Mutex decode_mutex_; | 155 Mutex decode_mutex_; |
| 153 | 156 |
| 154 // Protect concurrent access to m_hasAlpha. | 157 // Protect concurrent access to m_hasAlpha. |
| 155 Mutex alpha_mutex_; | 158 Mutex alpha_mutex_; |
| 156 }; | 159 }; |
| 157 | 160 |
| 158 } // namespace blink | 161 } // namespace blink |
| 159 | 162 |
| 160 #endif | 163 #endif |
| OLD | NEW |