OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |