| 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 #ifndef SkPathOpsLine_DEFINED | 7 #ifndef SkPathOpsLine_DEFINED |
| 8 #define SkPathOpsLine_DEFINED | 8 #define SkPathOpsLine_DEFINED |
| 9 | 9 |
| 10 #include "SkPathOpsPoint.h" | 10 #include "SkPathOpsPoint.h" |
| 11 | 11 |
| 12 struct SkDLine { | 12 struct SkDLine { |
| 13 SkDPoint fPts[2]; | 13 SkDPoint fPts[2]; |
| 14 | 14 |
| 15 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < 2); return
fPts[n]; } |
| 16 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < 2); return fPts[n]; } |
| 17 |
| 15 void set(const SkPoint pts[2]) { | 18 void set(const SkPoint pts[2]) { |
| 16 fPts[0] = pts[0]; | 19 fPts[0] = pts[0]; |
| 17 fPts[1] = pts[1]; | 20 fPts[1] = pts[1]; |
| 18 } | 21 } |
| 19 | 22 |
| 20 const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < 2); return
fPts[n]; } | |
| 21 SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < 2); return fPts[n]; } | |
| 22 | |
| 23 double isLeft(const SkDPoint& pt) const; | |
| 24 SkDLine subDivide(double t1, double t2) const; | |
| 25 static SkDLine SubDivide(const SkPoint a[2], double t1, double t2) { | 23 static SkDLine SubDivide(const SkPoint a[2], double t1, double t2) { |
| 26 SkDLine line; | 24 SkDLine line; |
| 27 line.set(a); | 25 line.set(a); |
| 28 return line.subDivide(t1, t2); | 26 return line.subDivide(t1, t2); |
| 29 } | 27 } |
| 28 |
| 29 double exactPoint(const SkDPoint& xy) const; |
| 30 static double ExactPointH(const SkDPoint& xy, double left, double right, dou
ble y); |
| 31 static double ExactPointV(const SkDPoint& xy, double top, double bottom, dou
ble x); |
| 32 double isLeft(const SkDPoint& pt) const; |
| 33 double nearPoint(const SkDPoint& xy) const; |
| 34 static double NearPointH(const SkDPoint& xy, double left, double right, doub
le y); |
| 35 static double NearPointV(const SkDPoint& xy, double top, double bottom, doub
le x); |
| 36 SkDLine subDivide(double t1, double t2) const; |
| 30 SkDPoint xyAtT(double t) const; | 37 SkDPoint xyAtT(double t) const; |
| 31 private: | 38 private: |
| 32 SkDVector tangent() const { return fPts[0] - fPts[1]; } | 39 SkDVector tangent() const { return fPts[0] - fPts[1]; } |
| 33 }; | 40 }; |
| 34 | 41 |
| 35 #endif | 42 #endif |
| OLD | NEW |