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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 result->frames_[0].orientation_ = orientation; | 66 result->frames_[0].orientation_ = orientation; |
67 if (orientation.UsesWidthAsHeight()) | 67 if (orientation.UsesWidthAsHeight()) |
68 result->size_respecting_orientation_ = result->size_.TransposedSize(); | 68 result->size_respecting_orientation_ = result->size_.TransposedSize(); |
69 return result.Release(); | 69 return result.Release(); |
70 } | 70 } |
71 | 71 |
72 BitmapImage::BitmapImage(ImageObserver* observer) | 72 BitmapImage::BitmapImage(ImageObserver* observer) |
73 : Image(observer), | 73 : Image(observer), |
74 current_frame_(0), | 74 current_frame_(0), |
75 cached_frame_index_(0), | 75 cached_frame_index_(0), |
76 repetition_count_(kCAnimationNone), | |
77 repetition_count_status_(kUnknown), | |
78 repetitions_complete_(0), | |
79 desired_frame_start_time_(0), | |
80 frame_count_(0), | |
81 animation_policy_(kImageAnimationPolicyAllowed), | 76 animation_policy_(kImageAnimationPolicyAllowed), |
82 animation_finished_(false), | 77 animation_finished_(false), |
83 all_data_received_(false), | 78 all_data_received_(false), |
84 have_size_(false), | 79 have_size_(false), |
85 size_available_(false), | 80 size_available_(false), |
86 have_frame_count_(false) {} | 81 have_frame_count_(false), |
| 82 repetition_count_status_(kUnknown), |
| 83 repetition_count_(kCAnimationNone), |
| 84 repetitions_complete_(0), |
| 85 desired_frame_start_time_(0), |
| 86 frame_count_(0) {} |
87 | 87 |
88 BitmapImage::BitmapImage(const SkBitmap& bitmap, ImageObserver* observer) | 88 BitmapImage::BitmapImage(const SkBitmap& bitmap, ImageObserver* observer) |
89 : Image(observer), | 89 : Image(observer), |
90 size_(bitmap.width(), bitmap.height()), | 90 size_(bitmap.width(), bitmap.height()), |
91 current_frame_(0), | 91 current_frame_(0), |
92 cached_frame_(SkImage::MakeFromBitmap(bitmap)), | 92 cached_frame_(SkImage::MakeFromBitmap(bitmap)), |
93 cached_frame_index_(0), | 93 cached_frame_index_(0), |
94 repetition_count_(kCAnimationNone), | |
95 repetition_count_status_(kUnknown), | |
96 repetitions_complete_(0), | |
97 frame_count_(1), | |
98 animation_policy_(kImageAnimationPolicyAllowed), | 94 animation_policy_(kImageAnimationPolicyAllowed), |
99 animation_finished_(true), | 95 animation_finished_(true), |
100 all_data_received_(true), | 96 all_data_received_(true), |
101 have_size_(true), | 97 have_size_(true), |
102 size_available_(true), | 98 size_available_(true), |
103 have_frame_count_(true) { | 99 have_frame_count_(true), |
| 100 repetition_count_status_(kUnknown), |
| 101 repetition_count_(kCAnimationNone), |
| 102 repetitions_complete_(0), |
| 103 frame_count_(1) { |
104 // Since we don't have a decoder, we can't figure out the image orientation. | 104 // Since we don't have a decoder, we can't figure out the image orientation. |
105 // Set m_sizeRespectingOrientation to be the same as m_size so it's not 0x0. | 105 // Set m_sizeRespectingOrientation to be the same as m_size so it's not 0x0. |
106 size_respecting_orientation_ = size_; | 106 size_respecting_orientation_ = size_; |
107 | 107 |
108 frames_.Grow(1); | 108 frames_.Grow(1); |
109 frames_[0].has_alpha_ = !bitmap.isOpaque(); | 109 frames_[0].has_alpha_ = !bitmap.isOpaque(); |
110 frames_[0].have_metadata_ = true; | 110 frames_[0].have_metadata_ = true; |
111 } | 111 } |
112 | 112 |
113 BitmapImage::~BitmapImage() { | 113 BitmapImage::~BitmapImage() { |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 GetImageObserver()->AnimationAdvanced(this); | 648 GetImageObserver()->AnimationAdvanced(this); |
649 | 649 |
650 return true; | 650 return true; |
651 } | 651 } |
652 | 652 |
653 void BitmapImage::NotifyObserversOfAnimationAdvance(TimerBase*) { | 653 void BitmapImage::NotifyObserversOfAnimationAdvance(TimerBase*) { |
654 GetImageObserver()->AnimationAdvanced(this); | 654 GetImageObserver()->AnimationAdvanced(this); |
655 } | 655 } |
656 | 656 |
657 } // namespace blink | 657 } // namespace blink |
OLD | NEW |