| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/animation/PathInterpolationFunctions.h" | 5 #include "core/animation/PathInterpolationFunctions.h" |
| 6 | 6 |
| 7 #include "core/animation/InterpolatedSVGPathSource.h" | 7 #include "core/animation/InterpolatedSVGPathSource.h" |
| 8 #include "core/animation/InterpolationEnvironment.h" | 8 #include "core/animation/InterpolationEnvironment.h" |
| 9 #include "core/animation/SVGPathSegInterpolationFunctions.h" | 9 #include "core/animation/SVGPathSegInterpolationFunctions.h" |
| 10 #include "core/css/CSSPathValue.h" | 10 #include "core/css/CSSPathValue.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 InterpolationValue PathInterpolationFunctions::convertValue( | 50 InterpolationValue PathInterpolationFunctions::convertValue( |
| 51 const SVGPathByteStream& byteStream) { | 51 const SVGPathByteStream& byteStream) { |
| 52 SVGPathByteStreamSource pathSource(byteStream); | 52 SVGPathByteStreamSource pathSource(byteStream); |
| 53 size_t length = 0; | 53 size_t length = 0; |
| 54 PathCoordinates currentCoordinates; | 54 PathCoordinates currentCoordinates; |
| 55 Vector<std::unique_ptr<InterpolableValue>> interpolablePathSegs; | 55 Vector<std::unique_ptr<InterpolableValue>> interpolablePathSegs; |
| 56 Vector<SVGPathSegType> pathSegTypes; | 56 Vector<SVGPathSegType> pathSegTypes; |
| 57 | 57 |
| 58 while (pathSource.hasMoreData()) { | 58 while (pathSource.hasMoreData()) { |
| 59 const PathSegmentData segment = pathSource.parseSegment(); | 59 const PathSegmentData segment = pathSource.parseSegment(); |
| 60 interpolablePathSegs.append( | 60 interpolablePathSegs.push_back( |
| 61 SVGPathSegInterpolationFunctions::consumePathSeg(segment, | 61 SVGPathSegInterpolationFunctions::consumePathSeg(segment, |
| 62 currentCoordinates)); | 62 currentCoordinates)); |
| 63 pathSegTypes.append(segment.command); | 63 pathSegTypes.push_back(segment.command); |
| 64 length++; | 64 length++; |
| 65 } | 65 } |
| 66 | 66 |
| 67 std::unique_ptr<InterpolableList> pathArgs = InterpolableList::create(length); | 67 std::unique_ptr<InterpolableList> pathArgs = InterpolableList::create(length); |
| 68 for (size_t i = 0; i < interpolablePathSegs.size(); i++) | 68 for (size_t i = 0; i < interpolablePathSegs.size(); i++) |
| 69 pathArgs->set(i, std::move(interpolablePathSegs[i])); | 69 pathArgs->set(i, std::move(interpolablePathSegs[i])); |
| 70 | 70 |
| 71 std::unique_ptr<InterpolableList> result = | 71 std::unique_ptr<InterpolableList> result = |
| 72 InterpolableList::create(PathComponentIndexCount); | 72 InterpolableList::create(PathComponentIndexCount); |
| 73 result->set(PathArgsIndex, std::move(pathArgs)); | 73 result->set(PathArgsIndex, std::move(pathArgs)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 const InterpolationValue& underlying) const final { | 111 const InterpolationValue& underlying) const final { |
| 112 return m_pathSegTypes == getPathSegTypes(underlying); | 112 return m_pathSegTypes == getPathSegTypes(underlying); |
| 113 } | 113 } |
| 114 | 114 |
| 115 Vector<SVGPathSegType> m_pathSegTypes; | 115 Vector<SVGPathSegType> m_pathSegTypes; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 InterpolationValue PathInterpolationFunctions::maybeConvertNeutral( | 118 InterpolationValue PathInterpolationFunctions::maybeConvertNeutral( |
| 119 const InterpolationValue& underlying, | 119 const InterpolationValue& underlying, |
| 120 InterpolationType::ConversionCheckers& conversionCheckers) { | 120 InterpolationType::ConversionCheckers& conversionCheckers) { |
| 121 conversionCheckers.append(UnderlyingPathSegTypesChecker::create(underlying)); | 121 conversionCheckers.push_back( |
| 122 UnderlyingPathSegTypesChecker::create(underlying)); |
| 122 std::unique_ptr<InterpolableList> result = | 123 std::unique_ptr<InterpolableList> result = |
| 123 InterpolableList::create(PathComponentIndexCount); | 124 InterpolableList::create(PathComponentIndexCount); |
| 124 result->set(PathArgsIndex, toInterpolableList(*underlying.interpolableValue) | 125 result->set(PathArgsIndex, toInterpolableList(*underlying.interpolableValue) |
| 125 .get(PathArgsIndex) | 126 .get(PathArgsIndex) |
| 126 ->cloneAndZero()); | 127 ->cloneAndZero()); |
| 127 result->set(PathNeutralIndex, InterpolableNumber::create(1)); | 128 result->set(PathNeutralIndex, InterpolableNumber::create(1)); |
| 128 return InterpolationValue(std::move(result), | 129 return InterpolationValue(std::move(result), |
| 129 underlying.nonInterpolableValue.get()); | 130 underlying.nonInterpolableValue.get()); |
| 130 } | 131 } |
| 131 | 132 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 InterpolatedSVGPathSource source( | 192 InterpolatedSVGPathSource source( |
| 192 toInterpolableList( | 193 toInterpolableList( |
| 193 *toInterpolableList(interpolableValue).get(PathArgsIndex)), | 194 *toInterpolableList(interpolableValue).get(PathArgsIndex)), |
| 194 toSVGPathNonInterpolableValue(nonInterpolableValue)->pathSegTypes()); | 195 toSVGPathNonInterpolableValue(nonInterpolableValue)->pathSegTypes()); |
| 195 SVGPathByteStreamBuilder builder(*pathByteStream); | 196 SVGPathByteStreamBuilder builder(*pathByteStream); |
| 196 SVGPathParser::parsePath(source, builder); | 197 SVGPathParser::parsePath(source, builder); |
| 197 return pathByteStream; | 198 return pathByteStream; |
| 198 } | 199 } |
| 199 | 200 |
| 200 } // namespace blink | 201 } // namespace blink |
| OLD | NEW |