| 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 "include/core/SkPoint.h" |
| 11 |
#include "include/core/SkTypes.h" |
| 12 |
#include "src/pathops/SkPathOpsPoint.h" |
| 13 |
|
| 14 |
struct SkDLine { |
| 15 |
SkDPoint fPts[2]; |
| 16 |
|
| 17 |
const SkDPoint& operator[](int n) const { SkASSERT(n >= 0 && n < 2); return fPts[n]; } |
| 18 |
SkDPoint& operator[](int n) { SkASSERT(n >= 0 && n < 2); return fPts[n]; } |
| 19 |
|
| 20 |
const SkDLine& set(const SkPoint pts[2]) { |
| 21 |
fPts[0] = pts[0]; |
| 22 |
fPts[1] = pts[1]; |
| 23 |
return *this; |
| 24 |
} |
| 25 |
|
| 26 |
double exactPoint(const SkDPoint& xy) const; |
| 27 |
static double ExactPointH(const SkDPoint& xy, double left, double right, double y); |
| 28 |
static double ExactPointV(const SkDPoint& xy, double top, double bottom, double x); |
| 29 |
|
| 30 |
double nearPoint(const SkDPoint& xy, bool* unequal) const; |
| 31 |
bool nearRay(const SkDPoint& xy) const; |
| 32 |
static double NearPointH(const SkDPoint& xy, double left, double right, double y); |
| 33 |
static double NearPointV(const SkDPoint& xy, double top, double bottom, double x); |
| 34 |
SkDPoint ptAtT(double t) const; |
| 35 |
|
| 36 |
void dump() const; |
| 37 |
void dumpID(int ) const; |
| 38 |
void dumpInner() const; |
| 39 |
}; |
| 40 |
|
| 41 |
#endif |