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

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

Issue 1627703002: remove legacy defines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove SK_SUPPORT_LEGACY_PATH_MEASURE_TVALUE etc 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.cpp ('k') | src/core/SkPathMeasure.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 "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkCubicClipper.h" 9 #include "SkCubicClipper.h"
10 #include "SkErrorInternals.h" 10 #include "SkErrorInternals.h"
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 1405
1406 if (SkScalarNearlyZero(sinh)) { // angle is too tight 1406 if (SkScalarNearlyZero(sinh)) { // angle is too tight
1407 this->lineTo(x1, y1); 1407 this->lineTo(x1, y1);
1408 return; 1408 return;
1409 } 1409 }
1410 1410
1411 SkScalar dist = SkScalarAbs(SkScalarMulDiv(radius, SK_Scalar1 - cosh, sinh)) ; 1411 SkScalar dist = SkScalarAbs(SkScalarMulDiv(radius, SK_Scalar1 - cosh, sinh)) ;
1412 1412
1413 SkScalar xx = x1 - SkScalarMul(dist, before.fX); 1413 SkScalar xx = x1 - SkScalarMul(dist, before.fX);
1414 SkScalar yy = y1 - SkScalarMul(dist, before.fY); 1414 SkScalar yy = y1 - SkScalarMul(dist, before.fY);
1415 #ifndef SK_SUPPORT_LEGACY_ARCTO
1416 after.setLength(dist); 1415 after.setLength(dist);
1417 this->lineTo(xx, yy); 1416 this->lineTo(xx, yy);
1418 SkScalar weight = SkScalarSqrt(SK_ScalarHalf + cosh * SK_ScalarHalf); 1417 SkScalar weight = SkScalarSqrt(SK_ScalarHalf + cosh * SK_ScalarHalf);
1419 this->conicTo(x1, y1, x1 + after.fX, y1 + after.fY, weight); 1418 this->conicTo(x1, y1, x1 + after.fX, y1 + after.fY, weight);
1420 #else
1421 SkRotationDirection arcDir;
1422
1423 // now turn before/after into normals
1424 if (sinh > 0) {
1425 before.rotateCCW();
1426 after.rotateCCW();
1427 arcDir = kCW_SkRotationDirection;
1428 } else {
1429 before.rotateCW();
1430 after.rotateCW();
1431 arcDir = kCCW_SkRotationDirection;
1432 }
1433
1434 SkMatrix matrix;
1435 SkPoint pts[kSkBuildQuadArcStorage];
1436
1437 matrix.setScale(radius, radius);
1438 matrix.postTranslate(xx - SkScalarMul(radius, before.fX),
1439 yy - SkScalarMul(radius, before.fY));
1440
1441 int count = SkBuildQuadArc(before, after, arcDir, &matrix, pts);
1442
1443 this->incReserve(count);
1444 // [xx,yy] == pts[0]
1445 this->lineTo(xx, yy);
1446 for (int i = 1; i < count; i += 2) {
1447 this->quadTo(pts[i], pts[i+1]);
1448 }
1449 #endif
1450 } 1419 }
1451 1420
1452 /////////////////////////////////////////////////////////////////////////////// 1421 ///////////////////////////////////////////////////////////////////////////////
1453 1422
1454 void SkPath::addPath(const SkPath& path, SkScalar dx, SkScalar dy, AddPathMode m ode) { 1423 void SkPath::addPath(const SkPath& path, SkScalar dx, SkScalar dy, AddPathMode m ode) {
1455 SkMatrix matrix; 1424 SkMatrix matrix;
1456 1425
1457 matrix.setTranslate(dx, dy); 1426 matrix.setTranslate(dx, dy);
1458 this->addPath(path, matrix, mode); 1427 this->addPath(path, matrix, mode);
1459 } 1428 }
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 } 3172 }
3204 } while (!done); 3173 } while (!done);
3205 return SkToBool(tangents.count()) ^ isInverse; 3174 return SkToBool(tangents.count()) ^ isInverse;
3206 } 3175 }
3207 3176
3208 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2, 3177 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2,
3209 SkScalar w, SkPoint pts[], int pow2) { 3178 SkScalar w, SkPoint pts[], int pow2) {
3210 const SkConic conic(p0, p1, p2, w); 3179 const SkConic conic(p0, p1, p2, w);
3211 return conic.chopIntoQuadsPOW2(pts, pow2); 3180 return conic.chopIntoQuadsPOW2(pts, pow2);
3212 } 3181 }
OLDNEW
« no previous file with comments | « src/core/SkGeometry.cpp ('k') | src/core/SkPathMeasure.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698