OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 result.reserveCapacity(keyframes.size()); | 130 result.reserveCapacity(keyframes.size()); |
131 | 131 |
132 for (const auto& keyframe : keyframes) { | 132 for (const auto& keyframe : keyframes) { |
133 double offset = keyframe->offset(); | 133 double offset = keyframe->offset(); |
134 if (!isNull(offset)) { | 134 if (!isNull(offset)) { |
135 DCHECK_GE(offset, 0); | 135 DCHECK_GE(offset, 0); |
136 DCHECK_LE(offset, 1); | 136 DCHECK_LE(offset, 1); |
137 DCHECK_GE(offset, lastOffset); | 137 DCHECK_GE(offset, lastOffset); |
138 lastOffset = offset; | 138 lastOffset = offset; |
139 } | 139 } |
140 result.append(keyframe->clone()); | 140 result.push_back(keyframe->clone()); |
141 } | 141 } |
142 | 142 |
143 if (result.isEmpty()) | 143 if (result.isEmpty()) |
144 return result; | 144 return result; |
145 | 145 |
146 if (isNull(result.back()->offset())) | 146 if (isNull(result.back()->offset())) |
147 result.back()->setOffset(1); | 147 result.back()->setOffset(1); |
148 | 148 |
149 if (result.size() > 1 && isNull(result[0]->offset())) | 149 if (result.size() > 1 && isNull(result[0]->offset())) |
150 result.front()->setOffset(0); | 150 result.front()->setOffset(0); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 PassRefPtr<TimingFunction> easing, | 267 PassRefPtr<TimingFunction> easing, |
268 EffectModel::CompositeOperation composite) | 268 EffectModel::CompositeOperation composite) |
269 : m_offset(offset), m_easing(easing), m_composite(composite) { | 269 : m_offset(offset), m_easing(easing), m_composite(composite) { |
270 DCHECK(!isNull(offset)); | 270 DCHECK(!isNull(offset)); |
271 } | 271 } |
272 | 272 |
273 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup::appendKeyframe( | 273 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup::appendKeyframe( |
274 PassRefPtr<Keyframe::PropertySpecificKeyframe> keyframe) { | 274 PassRefPtr<Keyframe::PropertySpecificKeyframe> keyframe) { |
275 DCHECK(m_keyframes.isEmpty() || | 275 DCHECK(m_keyframes.isEmpty() || |
276 m_keyframes.back()->offset() <= keyframe->offset()); | 276 m_keyframes.back()->offset() <= keyframe->offset()); |
277 m_keyframes.append(keyframe); | 277 m_keyframes.push_back(keyframe); |
278 } | 278 } |
279 | 279 |
280 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup:: | 280 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup:: |
281 removeRedundantKeyframes() { | 281 removeRedundantKeyframes() { |
282 // As an optimization, removes interior keyframes that have the same offset | 282 // As an optimization, removes interior keyframes that have the same offset |
283 // as both their neighbours, as they will never be used by sample(). | 283 // as both their neighbours, as they will never be used by sample(). |
284 // Note that synthetic keyframes must be added before this method is | 284 // Note that synthetic keyframes must be added before this method is |
285 // called. | 285 // called. |
286 DCHECK_GE(m_keyframes.size(), 2U); | 286 DCHECK_GE(m_keyframes.size(), 2U); |
287 for (int i = m_keyframes.size() - 2; i > 0; --i) { | 287 for (int i = m_keyframes.size() - 2; i > 0; --i) { |
(...skipping 21 matching lines...) Expand all Loading... |
309 } | 309 } |
310 if (m_keyframes.back()->offset() != 1.0) { | 310 if (m_keyframes.back()->offset() != 1.0) { |
311 appendKeyframe(m_keyframes.back()->neutralKeyframe(1, nullptr)); | 311 appendKeyframe(m_keyframes.back()->neutralKeyframe(1, nullptr)); |
312 addedSyntheticKeyframe = true; | 312 addedSyntheticKeyframe = true; |
313 } | 313 } |
314 | 314 |
315 return addedSyntheticKeyframe; | 315 return addedSyntheticKeyframe; |
316 } | 316 } |
317 | 317 |
318 } // namespace blink | 318 } // namespace blink |
OLD | NEW |