OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCullPoints.h" | 8 #include "SkCullPoints.h" |
9 | 9 |
10 static bool cross_product_is_neg(const SkIPoint& v, int dx, int dy) { | 10 static bool cross_product_is_neg(const SkIPoint& v, int dx, int dy) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 fPrevPt.set(0, 0); | 69 fPrevPt.set(0, 0); |
70 fPrevResult = kNo_Result; | 70 fPrevResult = kNo_Result; |
71 } | 71 } |
72 | 72 |
73 void SkCullPoints::moveTo(int x, int y) { | 73 void SkCullPoints::moveTo(int x, int y) { |
74 fPrevPt.set(x, y); | 74 fPrevPt.set(x, y); |
75 fPrevResult = kNo_Result; // so we trigger a movetolineto later | 75 fPrevResult = kNo_Result; // so we trigger a movetolineto later |
76 } | 76 } |
77 | 77 |
78 SkCullPoints::LineToResult SkCullPoints::lineTo(int x, int y, SkIPoint line[]) { | 78 SkCullPoints::LineToResult SkCullPoints::lineTo(int x, int y, SkIPoint line[]) { |
79 SkASSERT(line != NULL); | 79 SkASSERT(line != nullptr); |
80 | 80 |
81 LineToResult result = kNo_Result; | 81 LineToResult result = kNo_Result; |
82 int x0 = fPrevPt.fX; | 82 int x0 = fPrevPt.fX; |
83 int y0 = fPrevPt.fY; | 83 int y0 = fPrevPt.fY; |
84 | 84 |
85 // need to upgrade sect_test to chop the result | 85 // need to upgrade sect_test to chop the result |
86 // and to correctly return kLineTo_Result when the result is connected | 86 // and to correctly return kLineTo_Result when the result is connected |
87 // to the previous call-out | 87 // to the previous call-out |
88 if (this->sect_test(x0, y0, x, y)) { | 88 if (this->sect_test(x0, y0, x, y)) { |
89 line[0].set(x0, y0); | 89 line[0].set(x0, y0); |
(...skipping 10 matching lines...) Expand all Loading... |
100 fPrevResult = result; | 100 fPrevResult = result; |
101 | 101 |
102 return result; | 102 return result; |
103 } | 103 } |
104 | 104 |
105 ////////////////////////////////////////////////////////////////////////////////
///////////////// | 105 ////////////////////////////////////////////////////////////////////////////////
///////////////// |
106 | 106 |
107 #include "SkPath.h" | 107 #include "SkPath.h" |
108 | 108 |
109 SkCullPointsPath::SkCullPointsPath() | 109 SkCullPointsPath::SkCullPointsPath() |
110 : fCP(), fPath(NULL) { | 110 : fCP(), fPath(nullptr) { |
111 } | 111 } |
112 | 112 |
113 SkCullPointsPath::SkCullPointsPath(const SkIRect& r, SkPath* dst) | 113 SkCullPointsPath::SkCullPointsPath(const SkIRect& r, SkPath* dst) |
114 : fCP(r), fPath(dst) { | 114 : fCP(r), fPath(dst) { |
115 } | 115 } |
116 | 116 |
117 void SkCullPointsPath::reset(const SkIRect& r, SkPath* dst) { | 117 void SkCullPointsPath::reset(const SkIRect& r, SkPath* dst) { |
118 fCP.reset(r); | 118 fCP.reset(r); |
119 fPath = dst; | 119 fPath = dst; |
120 } | 120 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 SkRegion rgn; | 202 SkRegion rgn; |
203 return rgn.setPath(*pathPtr, clip) ^ isInverse; | 203 return rgn.setPath(*pathPtr, clip) ^ isInverse; |
204 } | 204 } |
205 | 205 |
206 bool SkHitTestPath(const SkPath& path, SkScalar x, SkScalar y, bool hires) { | 206 bool SkHitTestPath(const SkPath& path, SkScalar x, SkScalar y, bool hires) { |
207 const SkScalar half = SK_ScalarHalf; | 207 const SkScalar half = SK_ScalarHalf; |
208 const SkScalar one = SK_Scalar1; | 208 const SkScalar one = SK_Scalar1; |
209 SkRect r = SkRect::MakeXYWH(x - half, y - half, one, one); | 209 SkRect r = SkRect::MakeXYWH(x - half, y - half, one, one); |
210 return SkHitTestPath(path, r, hires); | 210 return SkHitTestPath(path, r, hires); |
211 } | 211 } |
OLD | NEW |