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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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/AnimatableClipPathOperation.h" | 31 #include "core/animation/animatable/AnimatableClipPathOperation.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 bool AnimatableClipPathOperation::usesDefaultInterpolationWith( | |
36 const AnimatableValue* value) const { | |
37 const AnimatableClipPathOperation* toOperation = | |
38 toAnimatableClipPathOperation(value); | |
39 | |
40 if (m_operation->type() != ClipPathOperation::SHAPE || | |
41 toOperation->m_operation->type() != ClipPathOperation::SHAPE) | |
42 return true; | |
43 | |
44 const BasicShape* fromShape = | |
45 toShapeClipPathOperation(getClipPathOperation())->basicShape(); | |
46 const BasicShape* toShape = | |
47 toShapeClipPathOperation(toOperation->getClipPathOperation()) | |
48 ->basicShape(); | |
49 | |
50 return !fromShape->canBlend(toShape); | |
51 } | |
52 | |
53 PassRefPtr<AnimatableValue> AnimatableClipPathOperation::interpolateTo( | |
54 const AnimatableValue* value, | |
55 double fraction) const { | |
56 if (usesDefaultInterpolationWith(value)) | |
57 return defaultInterpolateTo(this, value, fraction); | |
58 | |
59 const AnimatableClipPathOperation* toOperation = | |
60 toAnimatableClipPathOperation(value); | |
61 const BasicShape* fromShape = | |
62 toShapeClipPathOperation(getClipPathOperation())->basicShape(); | |
63 const BasicShape* toShape = | |
64 toShapeClipPathOperation(toOperation->getClipPathOperation()) | |
65 ->basicShape(); | |
66 | |
67 return AnimatableClipPathOperation::create( | |
68 ShapeClipPathOperation::create(toShape->blend(fromShape, fraction)) | |
69 .get()); | |
70 } | |
71 | |
72 bool AnimatableClipPathOperation::equalTo(const AnimatableValue* value) const { | 35 bool AnimatableClipPathOperation::equalTo(const AnimatableValue* value) const { |
73 const ClipPathOperation* operation = | 36 const ClipPathOperation* operation = |
74 toAnimatableClipPathOperation(value)->m_operation.get(); | 37 toAnimatableClipPathOperation(value)->m_operation.get(); |
75 return m_operation == operation || | 38 return m_operation == operation || |
76 (m_operation && operation && *m_operation == *operation); | 39 (m_operation && operation && *m_operation == *operation); |
77 } | 40 } |
78 | 41 |
79 } // namespace blink | 42 } // namespace blink |
OLD | NEW |