SkPathOpsLine.h 1.2 KB

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