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

Side by Side Diff: src/utils/SkPatchUtils.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.cpp ('k') | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 Google Inc.
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 "SkPatchUtils.h" 8 #include "SkPatchUtils.h"
9 9
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 30 matching lines...) Expand all
41 41
42 /** 42 /**
43 * Receives the 4 control points of the cubic bezier. 43 * Receives the 4 control points of the cubic bezier.
44 */ 44 */
45 FwDCubicEvaluator(SkPoint a, SkPoint b, SkPoint c, SkPoint d) { 45 FwDCubicEvaluator(SkPoint a, SkPoint b, SkPoint c, SkPoint d) {
46 fPoints[0] = a; 46 fPoints[0] = a;
47 fPoints[1] = b; 47 fPoints[1] = b;
48 fPoints[2] = c; 48 fPoints[2] = c;
49 fPoints[3] = d; 49 fPoints[3] = d;
50 50
51 SkScalar cx[4], cy[4]; 51 SkCubicToCoeff(fPoints, fCoefs);
52 SkGetCubicCoeff(fPoints, cx, cy);
53 fCoefs[0].set(cx[0], cy[0]);
54 fCoefs[1].set(cx[1], cy[1]);
55 fCoefs[2].set(cx[2], cy[2]);
56 fCoefs[3].set(cx[3], cy[3]);
57 52
58 this->restart(1); 53 this->restart(1);
59 } 54 }
60 55
61 explicit FwDCubicEvaluator(const SkPoint points[4]) { 56 explicit FwDCubicEvaluator(const SkPoint points[4]) {
62 memcpy(fPoints, points, 4 * sizeof(SkPoint)); 57 memcpy(fPoints, points, 4 * sizeof(SkPoint));
63 58
64 SkScalar cx[4], cy[4]; 59 SkCubicToCoeff(fPoints, fCoefs);
65 SkGetCubicCoeff(fPoints, cx, cy);
66 fCoefs[0].set(cx[0], cy[0]);
67 fCoefs[1].set(cx[1], cy[1]);
68 fCoefs[2].set(cx[2], cy[2]);
69 fCoefs[3].set(cx[3], cy[3]);
70 60
71 this->restart(1); 61 this->restart(1);
72 } 62 }
73 63
74 /** 64 /**
75 * Restarts the forward differences evaluator to the first value of t = 0. 65 * Restarts the forward differences evaluator to the first value of t = 0.
76 */ 66 */
77 void restart(int divisions) { 67 void restart(int divisions) {
78 fDivisions = divisions; 68 fDivisions = divisions;
79 SkScalar h = 1.f / fDivisions; 69 SkScalar h = 1.f / fDivisions;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 data->fIndices[i + 4] = data->fIndices[i + 2]; 322 data->fIndices[i + 4] = data->fIndices[i + 2];
333 data->fIndices[i + 5] = (x + 1) * stride + y; 323 data->fIndices[i + 5] = (x + 1) * stride + y;
334 } 324 }
335 v = SkScalarClampMax(v + 1.f / lodY, 1); 325 v = SkScalarClampMax(v + 1.f / lodY, 1);
336 } 326 }
337 u = SkScalarClampMax(u + 1.f / lodX, 1); 327 u = SkScalarClampMax(u + 1.f / lodX, 1);
338 } 328 }
339 return true; 329 return true;
340 330
341 } 331 }
OLDNEW
« no previous file with comments | « src/core/SkGeometry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698