| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * 2006 Rob Buis <buis@kde.org> | 3 * 2006 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2013 Google Inc. All rights reserved. | 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 6 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 6 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 308 } |
| 309 | 309 |
| 310 void Path::closeSubpath() | 310 void Path::closeSubpath() |
| 311 { | 311 { |
| 312 m_path.close(); | 312 m_path.close(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void Path::addEllipse(const FloatPoint& p, float radiusX, float radiusY, float s
tartAngle, float endAngle, bool anticlockwise) | 315 void Path::addEllipse(const FloatPoint& p, float radiusX, float radiusY, float s
tartAngle, float endAngle, bool anticlockwise) |
| 316 { | 316 { |
| 317 ASSERT(ellipseIsRenderable(startAngle, endAngle)); | 317 ASSERT(ellipseIsRenderable(startAngle, endAngle)); |
| 318 ASSERT(startAngle >= 0 && startAngle < 2 * piFloat); | 318 ASSERT(startAngle >= 0 && startAngle < twoPiFloat); |
| 319 ASSERT((anticlockwise && (startAngle - endAngle) >= 0) || (!anticlockwise &&
(endAngle - startAngle) >= 0)); | 319 ASSERT((anticlockwise && (startAngle - endAngle) >= 0) || (!anticlockwise &&
(endAngle - startAngle) >= 0)); |
| 320 | 320 |
| 321 SkScalar cx = WebCoreFloatToSkScalar(p.x()); | 321 SkScalar cx = WebCoreFloatToSkScalar(p.x()); |
| 322 SkScalar cy = WebCoreFloatToSkScalar(p.y()); | 322 SkScalar cy = WebCoreFloatToSkScalar(p.y()); |
| 323 SkScalar radiusXScalar = WebCoreFloatToSkScalar(radiusX); | 323 SkScalar radiusXScalar = WebCoreFloatToSkScalar(radiusX); |
| 324 SkScalar radiusYScalar = WebCoreFloatToSkScalar(radiusY); | 324 SkScalar radiusYScalar = WebCoreFloatToSkScalar(radiusY); |
| 325 | 325 |
| 326 SkRect oval; | 326 SkRect oval; |
| 327 oval.set(cx - radiusXScalar, cy - radiusYScalar, cx + radiusXScalar, cy + ra
diusYScalar); | 327 oval.set(cx - radiusXScalar, cy - radiusYScalar, cx + radiusXScalar, cy + ra
diusYScalar); |
| 328 | 328 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 356 } | 356 } |
| 357 | 357 |
| 358 void Path::addRect(const FloatRect& rect) | 358 void Path::addRect(const FloatRect& rect) |
| 359 { | 359 { |
| 360 m_path.addRect(rect); | 360 m_path.addRect(rect); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void Path::addEllipse(const FloatPoint& p, float radiusX, float radiusY, float r
otation, float startAngle, float endAngle, bool anticlockwise) | 363 void Path::addEllipse(const FloatPoint& p, float radiusX, float radiusY, float r
otation, float startAngle, float endAngle, bool anticlockwise) |
| 364 { | 364 { |
| 365 ASSERT(ellipseIsRenderable(startAngle, endAngle)); | 365 ASSERT(ellipseIsRenderable(startAngle, endAngle)); |
| 366 ASSERT(startAngle >= 0 && startAngle < 2 * piFloat); | 366 ASSERT(startAngle >= 0 && startAngle < twoPiFloat); |
| 367 ASSERT((anticlockwise && (startAngle - endAngle) >= 0) || (!anticlockwise &&
(endAngle - startAngle) >= 0)); | 367 ASSERT((anticlockwise && (startAngle - endAngle) >= 0) || (!anticlockwise &&
(endAngle - startAngle) >= 0)); |
| 368 | 368 |
| 369 if (!rotation) { | 369 if (!rotation) { |
| 370 addEllipse(FloatPoint(p.x(), p.y()), radiusX, radiusY, startAngle, endAn
gle, anticlockwise); | 370 addEllipse(FloatPoint(p.x(), p.y()), radiusX, radiusY, startAngle, endAn
gle, anticlockwise); |
| 371 return; | 371 return; |
| 372 } | 372 } |
| 373 | 373 |
| 374 // Add an arc after the relevant transform. | 374 // Add an arc after the relevant transform. |
| 375 AffineTransform ellipseTransform = AffineTransform::translation(p.x(), p.y()
).rotate(rad2deg(rotation)); | 375 AffineTransform ellipseTransform = AffineTransform::translation(p.x(), p.y()
).rotate(rad2deg(rotation)); |
| 376 ASSERT(ellipseTransform.isInvertible()); | 376 ASSERT(ellipseTransform.isInvertible()); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 } | 478 } |
| 479 | 479 |
| 480 bool Path::unionPath(const Path& other) | 480 bool Path::unionPath(const Path& other) |
| 481 { | 481 { |
| 482 return Op(m_path, other.m_path, kUnion_PathOp, &m_path); | 482 return Op(m_path, other.m_path, kUnion_PathOp, &m_path); |
| 483 } | 483 } |
| 484 | 484 |
| 485 #if !ASSERT_DISABLED | 485 #if !ASSERT_DISABLED |
| 486 bool ellipseIsRenderable(float startAngle, float endAngle) | 486 bool ellipseIsRenderable(float startAngle, float endAngle) |
| 487 { | 487 { |
| 488 return (std::abs(endAngle - startAngle) < 2 * piFloat) | 488 return (std::abs(endAngle - startAngle) < twoPiFloat) |
| 489 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), 2 * piFloat)
; | 489 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat); |
| 490 } | 490 } |
| 491 #endif | 491 #endif |
| 492 | 492 |
| 493 } | 493 } |
| OLD | NEW |