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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) | 256 void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) |
257 { | 257 { |
258 m_path.arcTo(p1, p2, WebCoreFloatToSkScalar(radius)); | 258 m_path.arcTo(p1, p2, WebCoreFloatToSkScalar(radius)); |
259 } | 259 } |
260 | 260 |
261 void Path::closeSubpath() | 261 void Path::closeSubpath() |
262 { | 262 { |
263 m_path.close(); | 263 m_path.close(); |
264 } | 264 } |
265 | 265 |
266 void Path::addArc(const FloatPoint& p, float r, float sa, float ea, bool anticlo
ckwise) | 266 void Path::addArc(const FloatPoint& p, float radius, float startAngle, float end
Angle, bool anticlockwise) |
267 { | 267 { |
268 SkScalar cx = WebCoreFloatToSkScalar(p.x()); | 268 SkScalar cx = WebCoreFloatToSkScalar(p.x()); |
269 SkScalar cy = WebCoreFloatToSkScalar(p.y()); | 269 SkScalar cy = WebCoreFloatToSkScalar(p.y()); |
270 SkScalar radius = WebCoreFloatToSkScalar(r); | 270 SkScalar radiusScalar = WebCoreFloatToSkScalar(radius); |
271 SkScalar s360 = SkIntToScalar(360); | 271 SkScalar s360 = SkIntToScalar(360); |
272 | 272 |
273 SkRect oval; | 273 SkRect oval; |
274 oval.set(cx - radius, cy - radius, cx + radius, cy + radius); | 274 oval.set(cx - radiusScalar, cy - radiusScalar, cx + radiusScalar, cy + radiu
sScalar); |
275 | 275 |
276 float sweep = ea - sa; | 276 float sweep = endAngle - startAngle; |
277 SkScalar startDegrees = WebCoreFloatToSkScalar(sa * 180 / piFloat); | 277 SkScalar startDegrees = WebCoreFloatToSkScalar(startAngle * 180 / piFloat); |
278 SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / piFloat); | 278 SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / piFloat); |
279 // Check for a circle. | 279 // Check for a circle. |
280 if (sweepDegrees >= s360 || sweepDegrees <= -s360) { | 280 if (sweepDegrees >= s360 || sweepDegrees <= -s360) { |
281 // Move to the start position (0 sweep means we add a single point). | 281 // Move to the start position (0 sweep means we add a single point). |
282 m_path.arcTo(oval, startDegrees, 0, false); | 282 m_path.arcTo(oval, startDegrees, 0, false); |
283 // Draw the circle. | 283 // Draw the circle. |
284 m_path.addOval(oval, anticlockwise ? | 284 m_path.addOval(oval, anticlockwise ? |
285 SkPath::kCCW_Direction : SkPath::kCW_Direction); | 285 SkPath::kCCW_Direction : SkPath::kCW_Direction); |
286 // Force a moveTo the end position. | 286 // Force a moveTo the end position. |
287 m_path.arcTo(oval, startDegrees + sweepDegrees, 0, true); | 287 m_path.arcTo(oval, startDegrees + sweepDegrees, 0, true); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 closeSubpath(); | 402 closeSubpath(); |
403 } | 403 } |
404 | 404 |
405 void Path::translate(const FloatSize& size) | 405 void Path::translate(const FloatSize& size) |
406 { | 406 { |
407 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s
ize.height())); | 407 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s
ize.height())); |
408 } | 408 } |
409 | 409 |
410 } | 410 } |
OLD | NEW |