| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/SVGPathSegInterpolationFunctions.h" | 5 #include "core/animation/SVGPathSegInterpolationFunctions.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const PathSegmentData& segment, | 61 const PathSegmentData& segment, |
| 62 PathCoordinates& coordinates) { | 62 PathCoordinates& coordinates) { |
| 63 bool isAbsolute = isAbsolutePathSegType(segment.command); | 63 bool isAbsolute = isAbsolutePathSegType(segment.command); |
| 64 std::unique_ptr<InterpolableList> result = InterpolableList::create(2); | 64 std::unique_ptr<InterpolableList> result = InterpolableList::create(2); |
| 65 result->set( | 65 result->set( |
| 66 0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); | 66 0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); |
| 67 result->set( | 67 result->set( |
| 68 1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY)); | 68 1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY)); |
| 69 | 69 |
| 70 if (toAbsolutePathSegType(segment.command) == PathSegMoveToAbs) { | 70 if (toAbsolutePathSegType(segment.command) == PathSegMoveToAbs) { |
| 71 // Any upcoming 'closepath' commands bring us back to the location we have j
ust moved to. | 71 // Any upcoming 'closepath' commands bring us back to the location we have |
| 72 // just moved to. |
| 72 coordinates.initialX = coordinates.currentX; | 73 coordinates.initialX = coordinates.currentX; |
| 73 coordinates.initialY = coordinates.currentY; | 74 coordinates.initialY = coordinates.currentY; |
| 74 } | 75 } |
| 75 | 76 |
| 76 return std::move(result); | 77 return std::move(result); |
| 77 } | 78 } |
| 78 | 79 |
| 79 PathSegmentData consumeInterpolableSingleCoordinate( | 80 PathSegmentData consumeInterpolableSingleCoordinate( |
| 80 const InterpolableValue& value, | 81 const InterpolableValue& value, |
| 81 SVGPathSegType segType, | 82 SVGPathSegType segType, |
| 82 PathCoordinates& coordinates) { | 83 PathCoordinates& coordinates) { |
| 83 const InterpolableList& list = toInterpolableList(value); | 84 const InterpolableList& list = toInterpolableList(value); |
| 84 bool isAbsolute = isAbsolutePathSegType(segType); | 85 bool isAbsolute = isAbsolutePathSegType(segType); |
| 85 PathSegmentData segment; | 86 PathSegmentData segment; |
| 86 segment.command = segType; | 87 segment.command = segType; |
| 87 segment.targetPoint.setX(consumeInterpolableCoordinateAxis( | 88 segment.targetPoint.setX(consumeInterpolableCoordinateAxis( |
| 88 list.get(0), isAbsolute, coordinates.currentX)); | 89 list.get(0), isAbsolute, coordinates.currentX)); |
| 89 segment.targetPoint.setY(consumeInterpolableCoordinateAxis( | 90 segment.targetPoint.setY(consumeInterpolableCoordinateAxis( |
| 90 list.get(1), isAbsolute, coordinates.currentY)); | 91 list.get(1), isAbsolute, coordinates.currentY)); |
| 91 | 92 |
| 92 if (toAbsolutePathSegType(segType) == PathSegMoveToAbs) { | 93 if (toAbsolutePathSegType(segType) == PathSegMoveToAbs) { |
| 93 // Any upcoming 'closepath' commands bring us back to the location we have j
ust moved to. | 94 // Any upcoming 'closepath' commands bring us back to the location we have |
| 95 // just moved to. |
| 94 coordinates.initialX = coordinates.currentX; | 96 coordinates.initialX = coordinates.currentX; |
| 95 coordinates.initialY = coordinates.currentY; | 97 coordinates.initialY = coordinates.currentY; |
| 96 } | 98 } |
| 97 | 99 |
| 98 return segment; | 100 return segment; |
| 99 } | 101 } |
| 100 | 102 |
| 101 std::unique_ptr<InterpolableValue> consumeCurvetoCubic( | 103 std::unique_ptr<InterpolableValue> consumeCurvetoCubic( |
| 102 const PathSegmentData& segment, | 104 const PathSegmentData& segment, |
| 103 PathCoordinates& coordinates) { | 105 PathCoordinates& coordinates) { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 return consumeInterpolableCurvetoCubicSmooth(value, segType, coordinates); | 372 return consumeInterpolableCurvetoCubicSmooth(value, segType, coordinates); |
| 371 | 373 |
| 372 case PathSegUnknown: | 374 case PathSegUnknown: |
| 373 default: | 375 default: |
| 374 NOTREACHED(); | 376 NOTREACHED(); |
| 375 return PathSegmentData(); | 377 return PathSegmentData(); |
| 376 } | 378 } |
| 377 } | 379 } |
| 378 | 380 |
| 379 } // namespace blink | 381 } // namespace blink |
| OLD | NEW |