| 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 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) | 269 void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) |
| 270 { | 270 { |
| 271 m_path.arcTo(p1, p2, WebCoreFloatToSkScalar(radius)); | 271 m_path.arcTo(p1, p2, WebCoreFloatToSkScalar(radius)); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void Path::closeSubpath() | 274 void Path::closeSubpath() |
| 275 { | 275 { |
| 276 m_path.close(); | 276 m_path.close(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void Path::addArc(const FloatPoint& p, float r, float sa, float ea, bool anticlo
ckwise) | 279 void Path::addArc(const FloatPoint& p, float radius, float startAngle, float end
Angle, bool anticlockwise) |
| 280 { | 280 { |
| 281 SkScalar cx = WebCoreFloatToSkScalar(p.x()); | 281 SkScalar cx = WebCoreFloatToSkScalar(p.x()); |
| 282 SkScalar cy = WebCoreFloatToSkScalar(p.y()); | 282 SkScalar cy = WebCoreFloatToSkScalar(p.y()); |
| 283 SkScalar radius = WebCoreFloatToSkScalar(r); | 283 SkScalar radiusScalar = WebCoreFloatToSkScalar(radius); |
| 284 SkScalar s360 = SkIntToScalar(360); | 284 SkScalar s360 = SkIntToScalar(360); |
| 285 | 285 |
| 286 SkRect oval; | 286 SkRect oval; |
| 287 oval.set(cx - radius, cy - radius, cx + radius, cy + radius); | 287 oval.set(cx - radiusScalar, cy - radiusScalar, cx + radiusScalar, cy + radiu
sScalar); |
| 288 | 288 |
| 289 float sweep = ea - sa; | 289 float sweep = endAngle - startAngle; |
| 290 SkScalar startDegrees = WebCoreFloatToSkScalar(sa * 180 / piFloat); | 290 SkScalar startDegrees = WebCoreFloatToSkScalar(startAngle * 180 / piFloat); |
| 291 SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / piFloat); | 291 SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / piFloat); |
| 292 // Check for a circle. | 292 // Check for a circle. |
| 293 if (sweepDegrees >= s360 || sweepDegrees <= -s360) { | 293 if (sweepDegrees >= s360 || sweepDegrees <= -s360) { |
| 294 // Move to the start position (0 sweep means we add a single point). | 294 // Move to the start position (0 sweep means we add a single point). |
| 295 m_path.arcTo(oval, startDegrees, 0, false); | 295 m_path.arcTo(oval, startDegrees, 0, false); |
| 296 // Draw the circle. | 296 // Draw the circle. |
| 297 m_path.addOval(oval, anticlockwise ? | 297 m_path.addOval(oval, anticlockwise ? |
| 298 SkPath::kCCW_Direction : SkPath::kCW_Direction); | 298 SkPath::kCCW_Direction : SkPath::kCW_Direction); |
| 299 // Force a moveTo the end position. | 299 // Force a moveTo the end position. |
| 300 m_path.arcTo(oval, startDegrees + sweepDegrees, 0, true); | 300 m_path.arcTo(oval, startDegrees + sweepDegrees, 0, true); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 { | 414 { |
| 415 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s
ize.height())); | 415 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s
ize.height())); |
| 416 } | 416 } |
| 417 | 417 |
| 418 bool Path::unionPath(const Path& other) | 418 bool Path::unionPath(const Path& other) |
| 419 { | 419 { |
| 420 return Op(m_path, other.m_path, kUnion_PathOp, &m_path); | 420 return Op(m_path, other.m_path, kUnion_PathOp, &m_path); |
| 421 } | 421 } |
| 422 | 422 |
| 423 } | 423 } |
| OLD | NEW |