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

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

Issue 2487913002: Remove InterpolableBool and existing use of it in SVG path interpolation (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 PathCoordinates& coordinates) { 181 PathCoordinates& coordinates) {
182 bool isAbsolute = isAbsolutePathSegType(segment.command); 182 bool isAbsolute = isAbsolutePathSegType(segment.command);
183 std::unique_ptr<InterpolableList> result = InterpolableList::create(7); 183 std::unique_ptr<InterpolableList> result = InterpolableList::create(7);
184 result->set( 184 result->set(
185 0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX)); 185 0, consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX));
186 result->set( 186 result->set(
187 1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY)); 187 1, consumeCoordinateAxis(segment.y(), isAbsolute, coordinates.currentY));
188 result->set(2, InterpolableNumber::create(segment.r1())); 188 result->set(2, InterpolableNumber::create(segment.r1()));
189 result->set(3, InterpolableNumber::create(segment.r2())); 189 result->set(3, InterpolableNumber::create(segment.r2()));
190 result->set(4, InterpolableNumber::create(segment.arcAngle())); 190 result->set(4, InterpolableNumber::create(segment.arcAngle()));
191 result->set(5, InterpolableBool::create(segment.largeArcFlag())); 191 // TODO(alancutter): Make these flags part of the NonInterpolableValue.
192 result->set(6, InterpolableBool::create(segment.sweepFlag())); 192 result->set(5, InterpolableNumber::create(segment.largeArcFlag()));
193 result->set(6, InterpolableNumber::create(segment.sweepFlag()));
193 return std::move(result); 194 return std::move(result);
194 } 195 }
195 196
196 PathSegmentData consumeInterpolableArc(const InterpolableValue& value, 197 PathSegmentData consumeInterpolableArc(const InterpolableValue& value,
197 SVGPathSegType segType, 198 SVGPathSegType segType,
198 PathCoordinates& coordinates) { 199 PathCoordinates& coordinates) {
199 const InterpolableList& list = toInterpolableList(value); 200 const InterpolableList& list = toInterpolableList(value);
200 bool isAbsolute = isAbsolutePathSegType(segType); 201 bool isAbsolute = isAbsolutePathSegType(segType);
201 PathSegmentData segment; 202 PathSegmentData segment;
202 segment.command = segType; 203 segment.command = segType;
203 segment.targetPoint.setX(consumeInterpolableCoordinateAxis( 204 segment.targetPoint.setX(consumeInterpolableCoordinateAxis(
204 list.get(0), isAbsolute, coordinates.currentX)); 205 list.get(0), isAbsolute, coordinates.currentX));
205 segment.targetPoint.setY(consumeInterpolableCoordinateAxis( 206 segment.targetPoint.setY(consumeInterpolableCoordinateAxis(
206 list.get(1), isAbsolute, coordinates.currentY)); 207 list.get(1), isAbsolute, coordinates.currentY));
207 segment.arcRadii().setX(toInterpolableNumber(list.get(2))->value()); 208 segment.arcRadii().setX(toInterpolableNumber(list.get(2))->value());
208 segment.arcRadii().setY(toInterpolableNumber(list.get(3))->value()); 209 segment.arcRadii().setY(toInterpolableNumber(list.get(3))->value());
209 segment.setArcAngle(toInterpolableNumber(list.get(4))->value()); 210 segment.setArcAngle(toInterpolableNumber(list.get(4))->value());
210 segment.arcLarge = toInterpolableBool(list.get(5))->value(); 211 segment.arcLarge = toInterpolableNumber(list.get(5))->value() >= 0.5;
211 segment.arcSweep = toInterpolableBool(list.get(6))->value(); 212 segment.arcSweep = toInterpolableNumber(list.get(6))->value() >= 0.5;
212 return segment; 213 return segment;
213 } 214 }
214 215
215 std::unique_ptr<InterpolableValue> consumeLinetoHorizontal( 216 std::unique_ptr<InterpolableValue> consumeLinetoHorizontal(
216 const PathSegmentData& segment, 217 const PathSegmentData& segment,
217 PathCoordinates& coordinates) { 218 PathCoordinates& coordinates) {
218 bool isAbsolute = isAbsolutePathSegType(segment.command); 219 bool isAbsolute = isAbsolutePathSegType(segment.command);
219 return consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX); 220 return consumeCoordinateAxis(segment.x(), isAbsolute, coordinates.currentX);
220 } 221 }
221 222
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 return consumeInterpolableCurvetoCubicSmooth(value, segType, coordinates); 373 return consumeInterpolableCurvetoCubicSmooth(value, segType, coordinates);
373 374
374 case PathSegUnknown: 375 case PathSegUnknown:
375 default: 376 default:
376 NOTREACHED(); 377 NOTREACHED();
377 return PathSegmentData(); 378 return PathSegmentData();
378 } 379 }
379 } 380 }
380 381
381 } // namespace blink 382 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/InterpolableValueTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698