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

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

Issue 1084623004: remove older version of cubic->coeff (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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/utils/SkPatchUtils.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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 dst[0] = src[0]; 334 dst[0] = src[0];
335 dst[1] = to_point(s0 + (s1 - s0) * scale); 335 dst[1] = to_point(s0 + (s1 - s0) * scale);
336 dst[2] = to_point(s2 + (s1 - s2) * scale); 336 dst[2] = to_point(s2 + (s1 - s2) * scale);
337 dst[3] = src[2]; 337 dst[3] = src[2];
338 } 338 }
339 339
340 ////////////////////////////////////////////////////////////////////////////// 340 //////////////////////////////////////////////////////////////////////////////
341 ///// CUBICS // CUBICS // CUBICS // CUBICS // CUBICS // CUBICS // CUBICS ///// 341 ///// CUBICS // CUBICS // CUBICS // CUBICS // CUBICS // CUBICS // CUBICS /////
342 ////////////////////////////////////////////////////////////////////////////// 342 //////////////////////////////////////////////////////////////////////////////
343 343
344 static void get_cubic_coeff(const SkScalar pt[], SkScalar coeff[4]) {
345 coeff[0] = pt[6] + 3*(pt[2] - pt[4]) - pt[0];
346 coeff[1] = 3*(pt[4] - pt[2] - pt[2] + pt[0]);
347 coeff[2] = 3*(pt[2] - pt[0]);
348 coeff[3] = pt[0];
349 }
350
351 void SkGetCubicCoeff(const SkPoint pts[4], SkScalar cx[4], SkScalar cy[4]) {
352 SkASSERT(pts);
353
354 if (cx) {
355 get_cubic_coeff(&pts[0].fX, cx);
356 }
357 if (cy) {
358 get_cubic_coeff(&pts[0].fY, cy);
359 }
360 }
361
362 static SkScalar eval_cubic(const SkScalar src[], SkScalar t) { 344 static SkScalar eval_cubic(const SkScalar src[], SkScalar t) {
363 SkASSERT(src); 345 SkASSERT(src);
364 SkASSERT(t >= 0 && t <= SK_Scalar1); 346 SkASSERT(t >= 0 && t <= SK_Scalar1);
365 347
366 if (t == 0) { 348 if (t == 0) {
367 return src[0]; 349 return src[0];
368 } 350 }
369 351
370 #ifdef DIRECT_EVAL_OF_POLYNOMIALS 352 #ifdef DIRECT_EVAL_OF_POLYNOMIALS
371 SkScalar D = src[0]; 353 SkScalar D = src[0];
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 matrix.preScale(SK_Scalar1, -SK_Scalar1); 1550 matrix.preScale(SK_Scalar1, -SK_Scalar1);
1569 } 1551 }
1570 if (userMatrix) { 1552 if (userMatrix) {
1571 matrix.postConcat(*userMatrix); 1553 matrix.postConcat(*userMatrix);
1572 } 1554 }
1573 for (int i = 0; i < conicCount; ++i) { 1555 for (int i = 0; i < conicCount; ++i) {
1574 matrix.mapPoints(dst[i].fPts, 3); 1556 matrix.mapPoints(dst[i].fPts, 3);
1575 } 1557 }
1576 return conicCount; 1558 return conicCount;
1577 } 1559 }
OLDNEW
« no previous file with comments | « src/core/SkGeometry.h ('k') | src/utils/SkPatchUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698