| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2012 Google Inc. | 2  * Copyright 2012 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 #include "SkIntersections.h" | 7 #include "SkIntersections.h" | 
| 8 #include "SkLineParameters.h" | 8 #include "SkLineParameters.h" | 
| 9 #include "SkPathOpsCubic.h" | 9 #include "SkPathOpsCubic.h" | 
| 10 #include "SkPathOpsCurve.h" | 10 #include "SkPathOpsCurve.h" | 
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 154     largest = SkTMax(largest, -tiniest); | 154     largest = SkTMax(largest, -tiniest); | 
| 155     return approximately_zero_when_compared_to(distance, largest); | 155     return approximately_zero_when_compared_to(distance, largest); | 
| 156 } | 156 } | 
| 157 | 157 | 
| 158 SkDVector SkDQuad::dxdyAtT(double t) const { | 158 SkDVector SkDQuad::dxdyAtT(double t) const { | 
| 159     double a = t - 1; | 159     double a = t - 1; | 
| 160     double b = 1 - 2 * t; | 160     double b = 1 - 2 * t; | 
| 161     double c = t; | 161     double c = t; | 
| 162     SkDVector result = { a * fPts[0].fX + b * fPts[1].fX + c * fPts[2].fX, | 162     SkDVector result = { a * fPts[0].fX + b * fPts[1].fX + c * fPts[2].fX, | 
| 163             a * fPts[0].fY + b * fPts[1].fY + c * fPts[2].fY }; | 163             a * fPts[0].fY + b * fPts[1].fY + c * fPts[2].fY }; | 
|  | 164     if (result.fX == 0 && result.fY == 0) { | 
|  | 165         if (zero_or_one(t)) { | 
|  | 166             result = fPts[2] - fPts[0]; | 
|  | 167         } else { | 
|  | 168             // incomplete | 
|  | 169             SkDebugf("!q"); | 
|  | 170         } | 
|  | 171     } | 
| 164     return result; | 172     return result; | 
| 165 } | 173 } | 
| 166 | 174 | 
| 167 // OPTIMIZE: assert if caller passes in t == 0 / t == 1 ? | 175 // OPTIMIZE: assert if caller passes in t == 0 / t == 1 ? | 
| 168 SkDPoint SkDQuad::ptAtT(double t) const { | 176 SkDPoint SkDQuad::ptAtT(double t) const { | 
| 169     if (0 == t) { | 177     if (0 == t) { | 
| 170         return fPts[0]; | 178         return fPts[0]; | 
| 171     } | 179     } | 
| 172     if (1 == t) { | 180     if (1 == t) { | 
| 173         return fPts[2]; | 181         return fPts[2]; | 
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 333  * c =             C | 341  * c =             C | 
| 334  */ | 342  */ | 
| 335 void SkDQuad::SetABC(const double* quad, double* a, double* b, double* c) { | 343 void SkDQuad::SetABC(const double* quad, double* a, double* b, double* c) { | 
| 336     *a = quad[0];      // a = A | 344     *a = quad[0];      // a = A | 
| 337     *b = 2 * quad[2];  // b =     2*B | 345     *b = 2 * quad[2];  // b =     2*B | 
| 338     *c = quad[4];      // c =             C | 346     *c = quad[4];      // c =             C | 
| 339     *b -= *c;          // b =     2*B -   C | 347     *b -= *c;          // b =     2*B -   C | 
| 340     *a -= *b;          // a = A - 2*B +   C | 348     *a -= *b;          // a = A - 2*B +   C | 
| 341     *b -= *c;          // b =     2*B - 2*C | 349     *b -= *c;          // b =     2*B - 2*C | 
| 342 } | 350 } | 
| OLD | NEW | 
|---|