Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: src/core/SkGeometry.cpp

Issue 1612543003: replace arcto quads with a conic (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkGeometry.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkGeometry.h" 8 #include "SkGeometry.h"
9 #include "SkMatrix.h" 9 #include "SkMatrix.h"
10 #include "SkNx.h" 10 #include "SkNx.h"
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 bool SkChopMonoCubicAtY(SkPoint src[4], SkScalar y, SkPoint dst[7]) { 944 bool SkChopMonoCubicAtY(SkPoint src[4], SkScalar y, SkPoint dst[7]) {
945 return cubic_dchop_at_intercept(src, y, dst, &SkDCubic::horizontalIntersect) ; 945 return cubic_dchop_at_intercept(src, y, dst, &SkDCubic::horizontalIntersect) ;
946 } 946 }
947 947
948 bool SkChopMonoCubicAtX(SkPoint src[4], SkScalar x, SkPoint dst[7]) { 948 bool SkChopMonoCubicAtX(SkPoint src[4], SkScalar x, SkPoint dst[7]) {
949 return cubic_dchop_at_intercept(src, x, dst, &SkDCubic::verticalIntersect); 949 return cubic_dchop_at_intercept(src, x, dst, &SkDCubic::verticalIntersect);
950 } 950 }
951 951
952 /////////////////////////////////////////////////////////////////////////////// 952 ///////////////////////////////////////////////////////////////////////////////
953 953
954 #ifdef SK_SUPPORT_LEGACY_ARCTO
954 /* Find t value for quadratic [a, b, c] = d. 955 /* Find t value for quadratic [a, b, c] = d.
955 Return 0 if there is no solution within [0, 1) 956 Return 0 if there is no solution within [0, 1)
956 */ 957 */
957 static SkScalar quad_solve(SkScalar a, SkScalar b, SkScalar c, SkScalar d) { 958 static SkScalar quad_solve(SkScalar a, SkScalar b, SkScalar c, SkScalar d) {
958 // At^2 + Bt + C = d 959 // At^2 + Bt + C = d
959 SkScalar A = a - 2 * b + c; 960 SkScalar A = a - 2 * b + c;
960 SkScalar B = 2 * (b - a); 961 SkScalar B = 2 * (b - a);
961 SkScalar C = a - d; 962 SkScalar C = a - d;
962 963
963 SkScalar roots[2]; 964 SkScalar roots[2];
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 matrix.setSinCos(uStart.fY, uStart.fX); 1114 matrix.setSinCos(uStart.fY, uStart.fX);
1114 if (dir == kCCW_SkRotationDirection) { 1115 if (dir == kCCW_SkRotationDirection) {
1115 matrix.preScale(SK_Scalar1, -SK_Scalar1); 1116 matrix.preScale(SK_Scalar1, -SK_Scalar1);
1116 } 1117 }
1117 if (userMatrix) { 1118 if (userMatrix) {
1118 matrix.postConcat(*userMatrix); 1119 matrix.postConcat(*userMatrix);
1119 } 1120 }
1120 matrix.mapPoints(quadPoints, pointCount); 1121 matrix.mapPoints(quadPoints, pointCount);
1121 return pointCount; 1122 return pointCount;
1122 } 1123 }
1123 1124 #endif
1124 1125
1125 /////////////////////////////////////////////////////////////////////////////// 1126 ///////////////////////////////////////////////////////////////////////////////
1126 // 1127 //
1127 // NURB representation for conics. Helpful explanations at: 1128 // NURB representation for conics. Helpful explanations at:
1128 // 1129 //
1129 // http://citeseerx.ist.psu.edu/viewdoc/ 1130 // http://citeseerx.ist.psu.edu/viewdoc/
1130 // download?doi=10.1.1.44.5740&rep=rep1&type=ps 1131 // download?doi=10.1.1.44.5740&rep=rep1&type=ps
1131 // and 1132 // and
1132 // http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/NURBS/RB-conics.html 1133 // http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/NURBS/RB-conics.html
1133 // 1134 //
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 matrix.preScale(SK_Scalar1, -SK_Scalar1); 1592 matrix.preScale(SK_Scalar1, -SK_Scalar1);
1592 } 1593 }
1593 if (userMatrix) { 1594 if (userMatrix) {
1594 matrix.postConcat(*userMatrix); 1595 matrix.postConcat(*userMatrix);
1595 } 1596 }
1596 for (int i = 0; i < conicCount; ++i) { 1597 for (int i = 0; i < conicCount; ++i) {
1597 matrix.mapPoints(dst[i].fPts, 3); 1598 matrix.mapPoints(dst[i].fPts, 3);
1598 } 1599 }
1599 return conicCount; 1600 return conicCount;
1600 } 1601 }
OLDNEW
« no previous file with comments | « src/core/SkGeometry.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698