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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 static int build_arc_conics(const SkRect& oval, const SkVector& start, const SkV
ector& stop, | 1082 static int build_arc_conics(const SkRect& oval, const SkVector& start, const SkV
ector& stop, |
1083 SkRotationDirection dir, SkConic conics[SkConic::kMa
xConicsForArc], | 1083 SkRotationDirection dir, SkConic conics[SkConic::kMa
xConicsForArc], |
1084 SkPoint* singlePt) { | 1084 SkPoint* singlePt) { |
1085 SkMatrix matrix; | 1085 SkMatrix matrix; |
1086 | 1086 |
1087 matrix.setScale(SkScalarHalf(oval.width()), SkScalarHalf(oval.height())); | 1087 matrix.setScale(SkScalarHalf(oval.width()), SkScalarHalf(oval.height())); |
1088 matrix.postTranslate(oval.centerX(), oval.centerY()); | 1088 matrix.postTranslate(oval.centerX(), oval.centerY()); |
1089 | 1089 |
1090 int count = SkConic::BuildUnitArc(start, stop, dir, &matrix, conics); | 1090 int count = SkConic::BuildUnitArc(start, stop, dir, &matrix, conics); |
1091 if (0 == count) { | 1091 if (0 == count) { |
1092 matrix.mapXY(start.x(), start.y(), singlePt); | 1092 matrix.mapXY(stop.x(), stop.y(), singlePt); |
1093 } | 1093 } |
1094 return count; | 1094 return count; |
1095 } | 1095 } |
1096 | 1096 |
1097 void SkPath::addRoundRect(const SkRect& rect, const SkScalar radii[], | 1097 void SkPath::addRoundRect(const SkRect& rect, const SkScalar radii[], |
1098 Direction dir) { | 1098 Direction dir) { |
1099 SkRRect rrect; | 1099 SkRRect rrect; |
1100 rrect.setRectRadii(rect, (const SkVector*) radii); | 1100 rrect.setRectRadii(rect, (const SkVector*) radii); |
1101 this->addRRect(rrect, dir); | 1101 this->addRRect(rrect, dir); |
1102 } | 1102 } |
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3395 path->arcTo(oval, startAngle, 180.f, false); | 3395 path->arcTo(oval, startAngle, 180.f, false); |
3396 startAngle += 180.f; | 3396 startAngle += 180.f; |
3397 forceMoveTo = false; | 3397 forceMoveTo = false; |
3398 sweepAngle -= 360.f; | 3398 sweepAngle -= 360.f; |
3399 } | 3399 } |
3400 path->arcTo(oval, startAngle, sweepAngle, forceMoveTo); | 3400 path->arcTo(oval, startAngle, sweepAngle, forceMoveTo); |
3401 if (useCenter) { | 3401 if (useCenter) { |
3402 path->close(); | 3402 path->close(); |
3403 } | 3403 } |
3404 } | 3404 } |
OLD | NEW |