caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #ifndef SkPathOpsLine_DEFINED |
| 8 | #define SkPathOpsLine_DEFINED |
| 9 | |
| 10 | #include "SkPathOpsPoint.h" |
| 11 | |
| 12 | struct SkDLine { |
| 13 | SkDPoint fPts[2]; |
| 14 | |
caryclark@google.com | fa2aeee | 2013-07-15 13:29:13 +0000 | [diff] [blame] | 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 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 18 | const SkDLine& set(const SkPoint pts[2]) { |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 19 | fPts[0] = pts[0]; |
| 20 | fPts[1] = pts[1]; |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 21 | return *this; |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 22 | } |
| 23 | |
caryclark@google.com | fa2aeee | 2013-07-15 13:29:13 +0000 | [diff] [blame] | 24 | double exactPoint(const SkDPoint& xy) const; |
| 25 | static double ExactPointH(const SkDPoint& xy, double left, double right, double y); |
| 26 | static double ExactPointV(const SkDPoint& xy, double top, double bottom, double x); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 27 | |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 28 | double nearPoint(const SkDPoint& xy, bool* unequal) const; |
caryclark@google.com | 570863f | 2013-09-16 15:55:01 +0000 | [diff] [blame] | 29 | bool nearRay(const SkDPoint& xy) const; |
caryclark@google.com | fa2aeee | 2013-07-15 13:29:13 +0000 | [diff] [blame] | 30 | static double NearPointH(const SkDPoint& xy, double left, double right, double y); |
| 31 | static double NearPointV(const SkDPoint& xy, double top, double bottom, double x); |
caryclark@google.com | 4fdbb22 | 2013-07-23 15:27:41 +0000 | [diff] [blame] | 32 | SkDPoint ptAtT(double t) const; |
caryclark@google.com | 570863f | 2013-09-16 15:55:01 +0000 | [diff] [blame] | 33 | |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 34 | void dump() const; |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 35 | void dumpID(int ) const; |
| 36 | void dumpInner() const; |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | #endif |