Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 */
10 #ifndef SkCullPoints_DEFINED
11 #define SkCullPoints_DEFINED
13 #include "SkRect.h"
15 class SkCullPoints {
16 public:
17 SkCullPoints();
18 SkCullPoints(const SkIRect& r);
20 void reset(const SkIRect& r);
22 /** Start a contour at (x,y). Follow this with call(s) to lineTo(...)
23 */
24 void moveTo(int x, int y);
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]);
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
41 bool sect_test(int x0, int y0, int x1, int y1) const;
42 };
44 /////////////////////////////////////////////////////////////////////////////////
46 class SkPath;
48 /** \class SkCullPointsPath
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);
58 void reset(const SkIRect& r, SkPath* dst);
60 void moveTo(int x, int y);
61 void lineTo(int x, int y);
63 private:
64 SkCullPoints fCP;
65 SkPath* fPath;
66 };
68 bool SkHitTestPath(const SkPath&, SkRect& target, bool hires);
69 bool SkHitTestPath(const SkPath&, SkScalar x, SkScalar y, bool hires);
71 #endif