| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 597 |
| 598 void BitmapImage::AdvanceAnimationWithoutCatchUp(TimerBase*) { | 598 void BitmapImage::AdvanceAnimationWithoutCatchUp(TimerBase*) { |
| 599 if (InternalAdvanceAnimation()) | 599 if (InternalAdvanceAnimation()) |
| 600 StartAnimation(kDoNotCatchUp); | 600 StartAnimation(kDoNotCatchUp); |
| 601 } | 601 } |
| 602 | 602 |
| 603 bool BitmapImage::InternalAdvanceAnimation(AnimationAdvancement advancement) { | 603 bool BitmapImage::InternalAdvanceAnimation(AnimationAdvancement advancement) { |
| 604 // Stop the animation. | 604 // Stop the animation. |
| 605 StopAnimation(); | 605 StopAnimation(); |
| 606 | 606 |
| 607 if (!GetImageObserver()) |
| 608 return false; |
| 609 |
| 607 // See if anyone is still paying attention to this animation. If not, we | 610 // See if anyone is still paying attention to this animation. If not, we |
| 608 // don't advance, and will remain suspended at the current frame until the | 611 // don't advance, and will remain suspended at the current frame until the |
| 609 // animation is resumed. | 612 // animation is resumed. |
| 610 if (advancement != kSkipFramesToCatchUp && | 613 if (advancement != kSkipFramesToCatchUp && |
| 611 GetImageObserver()->ShouldPauseAnimation(this)) | 614 GetImageObserver()->ShouldPauseAnimation(this)) |
| 612 return false; | 615 return false; |
| 613 | 616 |
| 614 if (current_frame_ + 1 < FrameCount()) { | 617 if (current_frame_ + 1 < FrameCount()) { |
| 615 current_frame_++; | 618 current_frame_++; |
| 616 } else { | 619 } else { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 647 } | 650 } |
| 648 | 651 |
| 649 // We need to draw this frame if we advanced to it while not skipping. | 652 // We need to draw this frame if we advanced to it while not skipping. |
| 650 if (advancement != kSkipFramesToCatchUp) | 653 if (advancement != kSkipFramesToCatchUp) |
| 651 GetImageObserver()->AnimationAdvanced(this); | 654 GetImageObserver()->AnimationAdvanced(this); |
| 652 | 655 |
| 653 return true; | 656 return true; |
| 654 } | 657 } |
| 655 | 658 |
| 656 void BitmapImage::NotifyObserversOfAnimationAdvance(TimerBase*) { | 659 void BitmapImage::NotifyObserversOfAnimationAdvance(TimerBase*) { |
| 657 GetImageObserver()->AnimationAdvanced(this); | 660 if (GetImageObserver()) |
| 661 GetImageObserver()->AnimationAdvanced(this); |
| 658 } | 662 } |
| 659 | 663 |
| 660 } // namespace blink | 664 } // namespace blink |
| OLD | NEW |