| OLD | NEW |
| (Empty) |
| 1 | |
| 2 /* | |
| 3 * Copyright 2006 The Android Open Source Project | |
| 4 * | |
| 5 * Use of this source code is governed by a BSD-style license that can be | |
| 6 * found in the LICENSE file. | |
| 7 */ | |
| 8 | |
| 9 | |
| 10 #ifndef SkCullPoints_DEFINED | |
| 11 #define SkCullPoints_DEFINED | |
| 12 | |
| 13 #include "SkRect.h" | |
| 14 | |
| 15 class SkCullPoints { | |
| 16 public: | |
| 17 SkCullPoints(); | |
| 18 SkCullPoints(const SkIRect& r); | |
| 19 | |
| 20 void reset(const SkIRect& r); | |
| 21 | |
| 22 /** Start a contour at (x,y). Follow this with call(s) to lineTo(...) | |
| 23 */ | |
| 24 void moveTo(int x, int y); | |
| 25 | |
| 26 enum LineToResult { | |
| 27 kNo_Result, //!< line segment was completely clipped out | |
| 28 kLineTo_Result, //!< path.lineTo(pts[1]); | |
| 29 kMoveToLineTo_Result //!< path.moveTo(pts[0]); path.lineTo(pts[1]); | |
| 30 }; | |
| 31 /** Connect a line to the previous call to lineTo (or moveTo). | |
| 32 */ | |
| 33 LineToResult lineTo(int x, int y, SkIPoint pts[2]); | |
| 34 | |
| 35 private: | |
| 36 SkIRect fR; // the caller's rectangle | |
| 37 SkIPoint fAsQuad[4]; // cache of fR as 4 points | |
| 38 SkIPoint fPrevPt; // private state | |
| 39 LineToResult fPrevResult; // private state | |
| 40 | |
| 41 bool sect_test(int x0, int y0, int x1, int y1) const; | |
| 42 }; | |
| 43 | |
| 44 ////////////////////////////////////////////////////////////////////////////////
/ | |
| 45 | |
| 46 class SkPath; | |
| 47 | |
| 48 /** \class SkCullPointsPath | |
| 49 | |
| 50 Similar to SkCullPoints, but this class handles the return values | |
| 51 from lineTo, and automatically builds a SkPath with the result(s). | |
| 52 */ | |
| 53 class SkCullPointsPath { | |
| 54 public: | |
| 55 SkCullPointsPath(); | |
| 56 SkCullPointsPath(const SkIRect& r, SkPath* dst); | |
| 57 | |
| 58 void reset(const SkIRect& r, SkPath* dst); | |
| 59 | |
| 60 void moveTo(int x, int y); | |
| 61 void lineTo(int x, int y); | |
| 62 | |
| 63 private: | |
| 64 SkCullPoints fCP; | |
| 65 SkPath* fPath; | |
| 66 }; | |
| 67 | |
| 68 bool SkHitTestPath(const SkPath&, SkRect& target, bool hires); | |
| 69 bool SkHitTestPath(const SkPath&, SkScalar x, SkScalar y, bool hires); | |
| 70 | |
| 71 #endif | |
| OLD | NEW |