| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 | 153 |
| 154 void WEBPImageDecoder::OnSetData(SegmentReader*) { | 154 void WEBPImageDecoder::OnSetData(SegmentReader*) { |
| 155 have_already_parsed_this_data_ = false; | 155 have_already_parsed_this_data_ = false; |
| 156 } | 156 } |
| 157 | 157 |
| 158 int WEBPImageDecoder::RepetitionCount() const { | 158 int WEBPImageDecoder::RepetitionCount() const { |
| 159 return Failed() ? kAnimationLoopOnce : repetition_count_; | 159 return Failed() ? kAnimationLoopOnce : repetition_count_; |
| 160 } | 160 } |
| 161 | 161 |
| 162 bool WEBPImageDecoder::FrameIsCompleteAtIndex(size_t index) const { | 162 bool WEBPImageDecoder::FrameIsReceivedAtIndex(size_t index) const { |
| 163 if (!demux_ || demux_state_ <= WEBP_DEMUX_PARSING_HEADER) | 163 if (!demux_ || demux_state_ <= WEBP_DEMUX_PARSING_HEADER) |
| 164 return false; | 164 return false; |
| 165 if (!(format_flags_ & ANIMATION_FLAG)) | 165 if (!(format_flags_ & ANIMATION_FLAG)) |
| 166 return ImageDecoder::FrameIsCompleteAtIndex(index); | 166 return ImageDecoder::FrameIsReceivedAtIndex(index); |
| 167 bool frame_is_received_at_index = index < frame_buffer_cache_.size(); | 167 bool frame_is_received_at_index = index < frame_buffer_cache_.size(); |
| 168 return frame_is_received_at_index; | 168 return frame_is_received_at_index; |
| 169 } | 169 } |
| 170 | 170 |
| 171 float WEBPImageDecoder::FrameDurationAtIndex(size_t index) const { | 171 float WEBPImageDecoder::FrameDurationAtIndex(size_t index) const { |
| 172 return index < frame_buffer_cache_.size() | 172 return index < frame_buffer_cache_.size() |
| 173 ? frame_buffer_cache_[index].Duration() | 173 ? frame_buffer_cache_[index].Duration() |
| 174 : 0; | 174 : 0; |
| 175 } | 175 } |
| 176 | 176 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 504 |
| 505 switch (WebPIUpdate(decoder_, data_bytes, data_size)) { | 505 switch (WebPIUpdate(decoder_, data_bytes, data_size)) { |
| 506 case VP8_STATUS_OK: | 506 case VP8_STATUS_OK: |
| 507 ApplyPostProcessing(frame_index); | 507 ApplyPostProcessing(frame_index); |
| 508 buffer.SetHasAlpha((format_flags_ & ALPHA_FLAG) || | 508 buffer.SetHasAlpha((format_flags_ & ALPHA_FLAG) || |
| 509 frame_background_has_alpha_); | 509 frame_background_has_alpha_); |
| 510 buffer.SetStatus(ImageFrame::kFrameComplete); | 510 buffer.SetStatus(ImageFrame::kFrameComplete); |
| 511 ClearDecoder(); | 511 ClearDecoder(); |
| 512 return true; | 512 return true; |
| 513 case VP8_STATUS_SUSPENDED: | 513 case VP8_STATUS_SUSPENDED: |
| 514 if (!IsAllDataReceived() && !FrameIsCompleteAtIndex(frame_index)) { | 514 if (!IsAllDataReceived() && !FrameIsReceivedAtIndex(frame_index)) { |
| 515 ApplyPostProcessing(frame_index); | 515 ApplyPostProcessing(frame_index); |
| 516 return false; | 516 return false; |
| 517 } | 517 } |
| 518 // FALLTHROUGH | 518 // FALLTHROUGH |
| 519 default: | 519 default: |
| 520 Clear(); | 520 Clear(); |
| 521 return SetFailed(); | 521 return SetFailed(); |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 | 524 |
| 525 } // namespace blink | 525 } // namespace blink |
| OLD | NEW |