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

Side by Side Diff: Source/core/svg/SVGPathParser.cpp

Issue 170453004: Add constant twoPiDouble/twoPiFloat to MathExtras.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add constant values to header Created 6 years, 10 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) 2002, 2003 The Karbon Developers 2 * Copyright (C) 2002, 2003 The Karbon Developers
3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org>
5 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. 5 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 delta.scale(scaleFactor); 449 delta.scale(scaleFactor);
450 FloatPoint centerPoint = point1 + point2; 450 FloatPoint centerPoint = point1 + point2;
451 centerPoint.scale(0.5f, 0.5f); 451 centerPoint.scale(0.5f, 0.5f);
452 centerPoint.move(-delta.height(), delta.width()); 452 centerPoint.move(-delta.height(), delta.width());
453 453
454 float theta1 = FloatPoint(point1 - centerPoint).slopeAngleRadians(); 454 float theta1 = FloatPoint(point1 - centerPoint).slopeAngleRadians();
455 float theta2 = FloatPoint(point2 - centerPoint).slopeAngleRadians(); 455 float theta2 = FloatPoint(point2 - centerPoint).slopeAngleRadians();
456 456
457 float thetaArc = theta2 - theta1; 457 float thetaArc = theta2 - theta1;
458 if (thetaArc < 0 && sweepFlag) 458 if (thetaArc < 0 && sweepFlag)
459 thetaArc += 2 * piFloat; 459 thetaArc += twoPiFloat;
460 else if (thetaArc > 0 && !sweepFlag) 460 else if (thetaArc > 0 && !sweepFlag)
461 thetaArc -= 2 * piFloat; 461 thetaArc -= twoPiFloat;
462 462
463 pointTransform.makeIdentity(); 463 pointTransform.makeIdentity();
464 pointTransform.rotate(angle); 464 pointTransform.rotate(angle);
465 pointTransform.scale(rx, ry); 465 pointTransform.scale(rx, ry);
466 466
467 // Some results of atan2 on some platform implementations are not exact enou gh. So that we get more 467 // Some results of atan2 on some platform implementations are not exact enou gh. So that we get more
468 // cubic curves than expected here. Adding 0.001f reduces the count of sgeme nts to the correct count. 468 // cubic curves than expected here. Adding 0.001f reduces the count of sgeme nts to the correct count.
469 int segments = ceilf(fabsf(thetaArc / (piOverTwoFloat + 0.001f))); 469 int segments = ceilf(fabsf(thetaArc / (piOverTwoFloat + 0.001f)));
470 for (int i = 0; i < segments; ++i) { 470 for (int i = 0; i < segments; ++i) {
471 float startTheta = theta1 + i * thetaArc / segments; 471 float startTheta = theta1 + i * thetaArc / segments;
(...skipping 14 matching lines...) Expand all
486 point2 = targetPoint; 486 point2 = targetPoint;
487 point2.move(t * sinEndTheta, -t * cosEndTheta); 487 point2.move(t * sinEndTheta, -t * cosEndTheta);
488 488
489 m_consumer->curveToCubic(pointTransform.mapPoint(point1), pointTransform .mapPoint(point2), 489 m_consumer->curveToCubic(pointTransform.mapPoint(point1), pointTransform .mapPoint(point2),
490 pointTransform.mapPoint(targetPoint), AbsoluteC oordinates); 490 pointTransform.mapPoint(targetPoint), AbsoluteC oordinates);
491 } 491 }
492 return true; 492 return true;
493 } 493 }
494 494
495 } 495 }
OLDNEW
« no previous file with comments | « Source/core/rendering/shapes/PolygonShape.cpp ('k') | Source/modules/webaudio/RealtimeAnalyser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698