| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 2001 mozilla.org | 5 * Portions are Copyright (C) 2001 mozilla.org |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Stuart Parmenter <stuart@mozilla.com> | 8 * Stuart Parmenter <stuart@mozilla.com> |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 PNGImageDecoder::PNGImageDecoder(AlphaOption alpha_option, | 43 PNGImageDecoder::PNGImageDecoder(AlphaOption alpha_option, |
| 44 const ColorBehavior& color_behavior, | 44 const ColorBehavior& color_behavior, |
| 45 size_t max_decoded_bytes, | 45 size_t max_decoded_bytes, |
| 46 size_t offset) | 46 size_t offset) |
| 47 : ImageDecoder(alpha_option, color_behavior, max_decoded_bytes), | 47 : ImageDecoder(alpha_option, color_behavior, max_decoded_bytes), |
| 48 offset_(offset), | 48 offset_(offset), |
| 49 current_frame_(0), | 49 current_frame_(0), |
| 50 // It would be logical to default to kAnimationNone, but BitmapImage uses | 50 // It would be logical to default to kCAnimationNone, but BitmapImage uses |
| 51 // that as a signal to never check again, meaning the actual count will | 51 // that as a signal to never check again, meaning the actual count will |
| 52 // never be respected. | 52 // never be respected. |
| 53 repetition_count_(kAnimationLoopOnce), | 53 repetition_count_(kCAnimationLoopOnce), |
| 54 has_alpha_channel_(false), | 54 has_alpha_channel_(false), |
| 55 current_buffer_saw_alpha_(false) {} | 55 current_buffer_saw_alpha_(false) {} |
| 56 | 56 |
| 57 PNGImageDecoder::~PNGImageDecoder() {} | 57 PNGImageDecoder::~PNGImageDecoder() {} |
| 58 | 58 |
| 59 bool PNGImageDecoder::SetFailed() { | 59 bool PNGImageDecoder::SetFailed() { |
| 60 reader_.reset(); | 60 reader_.reset(); |
| 61 return ImageDecoder::SetFailed(); | 61 return ImageDecoder::SetFailed(); |
| 62 } | 62 } |
| 63 | 63 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 DCHECK(index < frame_buffer_cache_.size()); | 115 DCHECK(index < frame_buffer_cache_.size()); |
| 116 return frame_buffer_cache_[index].GetDisposalMethod() != | 116 return frame_buffer_cache_[index].GetDisposalMethod() != |
| 117 ImageFrame::kDisposeOverwritePrevious; | 117 ImageFrame::kDisposeOverwritePrevious; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void PNGImageDecoder::SetRepetitionCount(int repetition_count) { | 120 void PNGImageDecoder::SetRepetitionCount(int repetition_count) { |
| 121 repetition_count_ = repetition_count; | 121 repetition_count_ = repetition_count; |
| 122 } | 122 } |
| 123 | 123 |
| 124 int PNGImageDecoder::RepetitionCount() const { | 124 int PNGImageDecoder::RepetitionCount() const { |
| 125 return Failed() ? kAnimationLoopOnce : repetition_count_; | 125 return Failed() ? kCAnimationLoopOnce : repetition_count_; |
| 126 } | 126 } |
| 127 | 127 |
| 128 void PNGImageDecoder::InitializeNewFrame(size_t index) { | 128 void PNGImageDecoder::InitializeNewFrame(size_t index) { |
| 129 const PNGImageReader::FrameInfo& frame_info = reader_->GetFrameInfo(index); | 129 const PNGImageReader::FrameInfo& frame_info = reader_->GetFrameInfo(index); |
| 130 ImageFrame& buffer = frame_buffer_cache_[index]; | 130 ImageFrame& buffer = frame_buffer_cache_[index]; |
| 131 | 131 |
| 132 DCHECK(IntRect(IntPoint(), Size()).Contains(frame_info.frame_rect)); | 132 DCHECK(IntRect(IntPoint(), Size()).Contains(frame_info.frame_rect)); |
| 133 buffer.SetOriginalFrameRect(frame_info.frame_rect); | 133 buffer.SetOriginalFrameRect(frame_info.frame_rect); |
| 134 | 134 |
| 135 buffer.SetDuration(frame_info.duration); | 135 buffer.SetDuration(frame_info.duration); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 return reader_->FrameIsReceivedAtIndex(index); | 483 return reader_->FrameIsReceivedAtIndex(index); |
| 484 } | 484 } |
| 485 | 485 |
| 486 float PNGImageDecoder::FrameDurationAtIndex(size_t index) const { | 486 float PNGImageDecoder::FrameDurationAtIndex(size_t index) const { |
| 487 if (index < frame_buffer_cache_.size()) | 487 if (index < frame_buffer_cache_.size()) |
| 488 return frame_buffer_cache_[index].Duration(); | 488 return frame_buffer_cache_[index].Duration(); |
| 489 return 0; | 489 return 0; |
| 490 } | 490 } |
| 491 | 491 |
| 492 } // namespace blink | 492 } // namespace blink |
| OLD | NEW |