| 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 "SkReduceOrder.h" | 7 #include "SkReduceOrder.h" | 
| 8 | 8 | 
| 9 int SkReduceOrder::reduce(const SkDLine& line) { | 9 int SkReduceOrder::reduce(const SkDLine& line) { | 
| 10     fLine[0] = line[0]; | 10     fLine[0] = line[0]; | 
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 265     int order = reducer.reduce(quad); | 265     int order = reducer.reduce(quad); | 
| 266     if (order == 2) {  // quad became line | 266     if (order == 2) {  // quad became line | 
| 267         for (int index = 0; index < order; ++index) { | 267         for (int index = 0; index < order; ++index) { | 
| 268             *reducePts++ = reducer.fLine[index].asSkPoint(); | 268             *reducePts++ = reducer.fLine[index].asSkPoint(); | 
| 269         } | 269         } | 
| 270     } | 270     } | 
| 271     return SkPathOpsPointsToVerb(order - 1); | 271     return SkPathOpsPointsToVerb(order - 1); | 
| 272 } | 272 } | 
| 273 | 273 | 
| 274 SkPath::Verb SkReduceOrder::Cubic(const SkPoint a[4], SkPoint* reducePts) { | 274 SkPath::Verb SkReduceOrder::Cubic(const SkPoint a[4], SkPoint* reducePts) { | 
| 275     if (SkDPoint::ApproximatelyEqual(a[0], a[1]) && SkDPoint::ApproximatelyEqual
     (a[0], a[2]) |  | 
| 276             && SkDPoint::ApproximatelyEqual(a[0], a[3])) { |  | 
| 277         reducePts[0] = a[0]; |  | 
| 278         return SkPath::kMove_Verb; |  | 
| 279     } |  | 
| 280     SkDCubic cubic; | 275     SkDCubic cubic; | 
| 281     cubic.set(a); | 276     cubic.set(a); | 
| 282     SkReduceOrder reducer; | 277     SkReduceOrder reducer; | 
| 283     int order = reducer.reduce(cubic, kAllow_Quadratics); | 278     int order = reducer.reduce(cubic, kAllow_Quadratics); | 
| 284     if (order == 2 || order == 3) {  // cubic became line or quad | 279     if (order == 2 || order == 3) {  // cubic became line or quad | 
| 285         for (int index = 0; index < order; ++index) { | 280         for (int index = 0; index < order; ++index) { | 
| 286             *reducePts++ = reducer.fQuad[index].asSkPoint(); | 281             *reducePts++ = reducer.fQuad[index].asSkPoint(); | 
| 287         } | 282         } | 
| 288     } | 283     } | 
| 289     return SkPathOpsPointsToVerb(order - 1); | 284     return SkPathOpsPointsToVerb(order - 1); | 
| 290 } | 285 } | 
| OLD | NEW | 
|---|