Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: third_party/WebKit/Source/core/animation/animatable/AnimatableFilterOperations.cpp

Issue 2893313004: Remove unused AnimatableValue types (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/animation/animatable/AnimatableFilterOperations.h" 31 #include "core/animation/animatable/AnimatableFilterOperations.h"
32 32
33 #include <algorithm> 33 #include <algorithm>
34 34
35 namespace blink { 35 namespace blink {
36 36
37 bool AnimatableFilterOperations::UsesDefaultInterpolationWith(
38 const AnimatableValue* value) const {
39 const AnimatableFilterOperations* target =
40 ToAnimatableFilterOperations(value);
41 return !Operations().CanInterpolateWith(target->Operations());
42 }
43
44 PassRefPtr<AnimatableValue> AnimatableFilterOperations::InterpolateTo( 37 PassRefPtr<AnimatableValue> AnimatableFilterOperations::InterpolateTo(
45 const AnimatableValue* value, 38 const AnimatableValue* value,
46 double fraction) const { 39 double fraction) const {
47 if (UsesDefaultInterpolationWith(value)) 40 const AnimatableFilterOperations* target =
41 ToAnimatableFilterOperations(value);
42
43 if (!Operations().CanInterpolateWith(target->Operations()))
48 return DefaultInterpolateTo(this, value, fraction); 44 return DefaultInterpolateTo(this, value, fraction);
49 45
50 const AnimatableFilterOperations* target =
51 ToAnimatableFilterOperations(value);
52 FilterOperations result; 46 FilterOperations result;
53 size_t from_size = Operations().size(); 47 size_t from_size = Operations().size();
54 size_t to_size = target->Operations().size(); 48 size_t to_size = target->Operations().size();
55 size_t size = std::max(from_size, to_size); 49 size_t size = std::max(from_size, to_size);
56 for (size_t i = 0; i < size; i++) { 50 for (size_t i = 0; i < size; i++) {
57 FilterOperation* from = 51 FilterOperation* from =
58 (i < from_size) ? operation_wrapper_->Operations().Operations()[i].Get() 52 (i < from_size) ? operation_wrapper_->Operations().Operations()[i].Get()
59 : 0; 53 : 0;
60 FilterOperation* to = 54 FilterOperation* to =
61 (i < to_size) 55 (i < to_size)
62 ? target->operation_wrapper_->Operations().Operations()[i].Get() 56 ? target->operation_wrapper_->Operations().Operations()[i].Get()
63 : 0; 57 : 0;
64 FilterOperation* blended_op = FilterOperation::Blend(from, to, fraction); 58 FilterOperation* blended_op = FilterOperation::Blend(from, to, fraction);
65 if (blended_op) 59 if (blended_op)
66 result.Operations().push_back(blended_op); 60 result.Operations().push_back(blended_op);
67 else 61 else
68 NOTREACHED(); 62 NOTREACHED();
69 } 63 }
70 return AnimatableFilterOperations::Create(result); 64 return AnimatableFilterOperations::Create(result);
71 } 65 }
72 66
73 bool AnimatableFilterOperations::EqualTo(const AnimatableValue* value) const {
74 return Operations() == ToAnimatableFilterOperations(value)->Operations();
75 }
76
77 } // namespace blink 67 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698