Lines Matching defs:const
26 double distanceSquared(DPoint p) const {
32 double distance(DPoint p) const { return sqrt(this->distanceSquared(p)); }
80 double operator[](int index) const {
111 DPoint mapPoint(const SkPoint& src) const {
116 DPoint mapPoint(const DPoint& src) const {
126 static const double kClose = (SK_Scalar1 / 16.0);
127 static const double kCloseSqd = kClose * kClose;
128 static const double kNearlyZero = (SK_Scalar1 / (1 << 18));
129 static const double kTangentTolerance = (SK_Scalar1 / (1 << 11));
130 static const float kConicTolerance = 0.25f;
186 static inline double sign_of(const double &val) {
190 static bool is_colinear(const SkPoint pts[3]) {
221 const SkPoint& endPt() const {
230 const DPoint p0 = { fPts[0].fX, fPts[0].fY };
231 const DPoint p2 = { this->endPt().fX, this->endPt().fY };
232 const double p0x = p0.fX;
233 const double p0y = p0.fY;
234 const double p2x = p2.fX;
235 const double p2y = p2.fY;
243 const double cosTheta = (p2x - p0x) / hypotenuse;
244 const double sinTheta = (p2y - p0y) / hypotenuse;
255 const SkPoint _P1mP0 = fPts[1] - fPts[0];
263 const SkPoint m = fPts[0] + t;
266 const double p1x = fPts[1].fX;
267 const double p1y = fPts[1].fY;
269 const double p0xSqd = p0x * p0x;
270 const double p0ySqd = p0y * p0y;
271 const double p2xSqd = p2x * p2x;
272 const double p2ySqd = p2y * p2y;
273 const double p1xSqd = p1x * p1x;
274 const double p1ySqd = p1y * p1y;
276 const double p01xProd = p0x * p1x;
277 const double p02xProd = p0x * p2x;
278 const double b12xProd = p1x * p2x;
279 const double p01yProd = p0y * p1y;
280 const double p02yProd = p0y * p2y;
281 const double b12yProd = p1y * p2y;
284 const double sqrtA = p0y - (2.0 * p1y) + p2y;
285 const double a = sqrtA * sqrtA;
286 const double h = -1.0 * (p0y - (2.0 * p1y) + p2y) * (p0x - (2.0 * p1x) + p2x);
287 const double sqrtB = p0x - (2.0 * p1x) + p2x;
288 const double b = sqrtB * sqrtB;
289 const double c = (p0xSqd * p2ySqd) - (4.0 * p01xProd * b12yProd)
293 const double g = (p0x * p02yProd) - (2.0 * p0x * p1ySqd)
299 const double f = -((p0xSqd * p2y) - (2.0 * p01xProd * p1y)
306 const double cosTheta = sqrt(a / (a + b));
307 const double sinTheta = -1.0 * sign_of((a + b) * h) * sqrt(b / (a + b));
309 const double gDef = cosTheta * g - sinTheta * f;
310 const double fDef = sinTheta * g + cosTheta * f;
313 const double x0 = gDef / (a + b);
314 const double y0 = (1.0 / (2.0 * fDef)) * (c - (gDef * gDef / (a + b)));
317 const double lambda = -1.0 * ((a + b) / (2.0 * fDef));
321 const double lambda_cosTheta = lambda * cosTheta;
322 const double lambda_sinTheta = lambda * sinTheta;
349 static inline void add_line(const SkPoint pts[2], PathSegmentArray* segments) {
358 static inline void add_quad(const SkPoint pts[3], PathSegmentArray* segments) {
379 static inline void add_cubic(const SkPoint pts[4],
390 const PathSegment& segment,
391 const DPoint &xFormPt) {
392 static const float kThird = 0.33333333333f;
393 static const float kTwentySeventh = 0.037037037f;
395 const float a = 0.5f - (float)xFormPt.fY;
396 const float b = -0.5f * (float)xFormPt.fX;
398 const float a3 = a * a * a;
399 const float b2 = b * b;
401 const float c = (b2 * 0.25f) + (a3 * kTwentySeventh);
404 const float sqrtC = sqrt(c);
405 const float result = (float)cbrt((-b * 0.5f) + sqrtC) + (float)cbrt((-b * 0.5f) - sqrtC);
408 const float cosPhi = (float)sqrt((b2 * 0.25f) * (-27.f / a3)) * ((b > 0) ? -1.f : 1.f);
409 const float phi = (float)acos(cosPhi);
452 void precomputation_for_row(RowData *rowData, const PathSegment& segment,
453 const SkPoint& pointLeft, const SkPoint& pointRight) {
458 const DPoint& xFormPtLeft = segment.fXformMatrix.mapPoint(pointLeft);
459 const DPoint& xFormPtRight = segment.fXformMatrix.mapPoint(pointRight);
464 const double x1 = xFormPtLeft.fX;
465 const double y1 = xFormPtLeft.fY;
466 const double x2 = xFormPtRight.fX;
467 const double y2 = xFormPtRight.fY;
477 const double m = (y2 - y1) / (x2 - x1);
478 const double b = -m * x1 + y1;
480 const double m2 = m * m;
481 const double c = m2 + 4.0 * b;
483 const double tol = 4.0 * segment.fTangentTolScaledSqd / (m2 + 1.0);
499 const double d = sqrt(c);
506 const PathSegment& segment,
507 const SkPoint& point,
508 const DPoint& xFormPt,
509 const RowData& rowData) {
516 const double p1 = rowData.fXAtIntersection1;
517 const double p2 = rowData.fXAtIntersection2;
552 const double p = rowData.fXAtIntersection1;
567 static float distance_to_segment(const SkPoint& point,
568 const PathSegment& segment,
569 const RowData& rowData,
573 const DPoint xformPt = segment.fXformMatrix.mapPoint(point);
597 const float nearestPoint = calculate_nearest_point_for_quad(segment, xformPt);
605 const float distToB0T = (float)xformPt.distanceSquared(segment.fP0T);
606 const float distToB2T = (float)xformPt.distanceSquared(segment.fP2T);
633 const SkRect& segBB = segment.fBoundingBox;
635 const SkRect& paddedBB = segBB.makeOutset(SK_DistanceFieldPad, SK_DistanceFieldPad);
656 const float pY = row + 0.5f; // offset by 1/2? why?
659 const SkPoint pointLeft = SkPoint::Make((SkScalar)startColumn, pY);
660 const SkPoint pointRight = SkPoint::Make((SkScalar)endColumn, pY);
672 const float pX = col + 0.5f;
673 const SkPoint point = SkPoint::Make(pX, pY);
675 const float distSq = dataPtr[idx].fDistSq;
724 const SkPath& path, const SkMatrix& drawMatrix,
791 const SkPoint* quadPts = converter.computeQuads(e.fPts, weight, kConicTolerance);
834 const float miniDist = sqrt(dataPtr[idx].fDistSq);
835 const float dist = dfSign * miniDist;
849 const float miniDist = sqrt(dataPtr[idx].fDistSq);
850 const float dist = dfSign * miniDist;