OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include "SkBuffer.h" | 9 #include "SkBuffer.h" |
10 #include "SkCubicClipper.h" | 10 #include "SkCubicClipper.h" |
(...skipping 3323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3334 *start = 3; | 3334 *start = 3; |
3335 break; | 3335 break; |
3336 case 0b11: | 3336 case 0b11: |
3337 rect->set(rectPts[2].fX, rectPts[2].fY, rectPts[0].fX, rectPts[0].fY
); | 3337 rect->set(rectPts[2].fX, rectPts[2].fY, rectPts[0].fX, rectPts[0].fY
); |
3338 *direction = vec03IsVertical ? SkPath::kCW_Direction : SkPath::kCCW_
Direction; | 3338 *direction = vec03IsVertical ? SkPath::kCW_Direction : SkPath::kCCW_
Direction; |
3339 *start = 2; | 3339 *start = 2; |
3340 break; | 3340 break; |
3341 } | 3341 } |
3342 return true; | 3342 return true; |
3343 } | 3343 } |
| 3344 |
| 3345 void SkPathPriv::CreateDrawArcPath(SkPath* path, const SkRect& oval, SkScalar st
artAngle, |
| 3346 SkScalar sweepAngle, bool useCenter, bool isF
illNoPathEffect) { |
| 3347 SkASSERT(!oval.isEmpty()); |
| 3348 SkASSERT(sweepAngle); |
| 3349 |
| 3350 path->reset(); |
| 3351 path->setIsVolatile(true); |
| 3352 path->setFillType(SkPath::kWinding_FillType); |
| 3353 if (isFillNoPathEffect && SkScalarAbs(sweepAngle) >= 360.f) { |
| 3354 path->addOval(oval); |
| 3355 return; |
| 3356 } |
| 3357 if (useCenter) { |
| 3358 path->moveTo(oval.centerX(), oval.centerY()); |
| 3359 } |
| 3360 // Arc to mods at 360 and drawArc is not supposed to. |
| 3361 bool forceMoveTo = !useCenter; |
| 3362 while (sweepAngle <= -360.f) { |
| 3363 path->arcTo(oval, startAngle, -180.f, forceMoveTo); |
| 3364 startAngle -= 180.f; |
| 3365 path->arcTo(oval, startAngle, -180.f, false); |
| 3366 startAngle -= 180.f; |
| 3367 forceMoveTo = false; |
| 3368 sweepAngle += 360.f; |
| 3369 } |
| 3370 while (sweepAngle >= 360.f) { |
| 3371 path->arcTo(oval, startAngle, 180.f, forceMoveTo); |
| 3372 startAngle += 180.f; |
| 3373 path->arcTo(oval, startAngle, 180.f, false); |
| 3374 startAngle += 180.f; |
| 3375 forceMoveTo = false; |
| 3376 sweepAngle -= 360.f; |
| 3377 } |
| 3378 path->arcTo(oval, startAngle, sweepAngle, forceMoveTo); |
| 3379 if (useCenter) { |
| 3380 path->close(); |
| 3381 } |
| 3382 } |
OLD | NEW |