Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkBuffer.h" | 10 #include "SkBuffer.h" |
| (...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1076 fDirection = this->hasOnlyMoveTos() ? dir : kUnknown_Direction; | 1076 fDirection = this->hasOnlyMoveTos() ? dir : kUnknown_Direction; |
| 1077 | 1077 |
| 1078 SkAutoPathBoundsUpdate apbu(this, rect); | 1078 SkAutoPathBoundsUpdate apbu(this, rect); |
| 1079 SkAutoDisableDirectionCheck(this); | 1079 SkAutoDisableDirectionCheck(this); |
| 1080 | 1080 |
| 1081 if (skip_hori) { | 1081 if (skip_hori) { |
| 1082 rx = halfW; | 1082 rx = halfW; |
| 1083 } else if (skip_vert) { | 1083 } else if (skip_vert) { |
| 1084 ry = halfH; | 1084 ry = halfH; |
| 1085 } | 1085 } |
| 1086 | |
| 1087 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT | 1086 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT |
| 1088 SkScalar sx = SkScalarMul(rx, CUBIC_ARC_FACTOR); | 1087 SkScalar sx = SkScalarMul(rx, CUBIC_ARC_FACTOR); |
| 1089 SkScalar sy = SkScalarMul(ry, CUBIC_ARC_FACTOR); | 1088 SkScalar sy = SkScalarMul(ry, CUBIC_ARC_FACTOR); |
| 1090 | 1089 |
| 1091 this->incReserve(17); | 1090 this->incReserve(17); |
| 1092 #else | 1091 #else |
| 1093 // Please see SkBuildQuadArc for more information but, we need to pull | 1092 // The mid point of the quadratic arc approximation is half way between the two |
| 1094 // the off-curve quadratic points in a little bit to make the round | 1093 // control points. The float epsilon adjustment moves the on curve point out by |
| 1095 // rects convex. | 1094 // two bits, distributing the convex test error between the round rect approxima tion |
| 1096 static const SkScalar kOffCurveEpsilon = 0.0001f; | 1095 // and the convex cross product sign equality test. |
| 1096 SkScalar midPtX = rx * (SK_Scalar1 + SK_ScalarTanPIOver8 + FLT_EPSILON * 4) / 2; | |
| 1097 SkScalar midPtY = ry * (SK_Scalar1 + SK_ScalarTanPIOver8 + FLT_EPSILON * 4) / 2; | |
| 1097 | 1098 |
| 1098 SkScalar midPtX = rx * SK_ScalarRoot2Over2; | 1099 SkScalar offPtX = rx * SK_ScalarTanPIOver8; |
| 1099 SkScalar midPtY = ry * SK_ScalarRoot2Over2; | 1100 SkScalar offPtY = ry * SK_ScalarTanPIOver8; |
| 1100 | |
| 1101 SkScalar offPtX = rx * SK_ScalarTanPIOver8 - kOffCurveEpsilon; | |
| 1102 SkScalar offPtY = ry * SK_ScalarTanPIOver8 - kOffCurveEpsilon; | |
| 1103 | 1101 |
| 1104 this->incReserve(21); | 1102 this->incReserve(21); |
| 1105 #endif | 1103 #endif |
| 1106 this->moveTo(rect.fRight - rx, rect.fTop); // top-right | 1104 this->moveTo(rect.fRight - rx, rect.fTop); // top-right |
| 1107 if (dir == kCCW_Direction) { | 1105 if (dir == kCCW_Direction) { |
| 1108 if (!skip_hori) { | 1106 if (!skip_hori) { |
| 1109 this->lineTo(rect.fLeft + rx, rect.fTop); // top | 1107 this->lineTo(rect.fLeft + rx, rect.fTop); // top |
| 1110 } | 1108 } |
| 1111 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT | 1109 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT |
| 1112 this->cubicTo(rect.fLeft + rx - sx, rect.fTop, | 1110 this->cubicTo(rect.fLeft + rx - sx, rect.fTop, |
| 1113 rect.fLeft, rect.fTop + ry - sy, | 1111 rect.fLeft, rect.fTop + ry - sy, |
| 1114 rect.fLeft, rect.fTop + ry); // top-left | 1112 rect.fLeft, rect.fTop + ry); // top-left |
| 1115 #else | 1113 #else |
| 1116 this->quadTo(rect.fLeft + rx - offPtX, rect.fTop + kOffCurveEpsilon, | 1114 this->quadTo(rect.fLeft + rx - offPtX, rect.fTop, |
| 1117 rect.fLeft + rx - midPtX, rect.fTop + ry - midPtY); | 1115 rect.fLeft + rx - midPtX, rect.fTop + ry - midPtY); |
| 1118 this->quadTo(rect.fLeft + kOffCurveEpsilon, rect.fTop + ry - offPtY, | 1116 this->quadTo(rect.fLeft, rect.fTop + ry - offPtY, |
| 1119 rect.fLeft, rect.fTop + ry); | 1117 rect.fLeft, rect.fTop + ry); |
| 1120 #endif | 1118 #endif |
| 1121 if (!skip_vert) { | 1119 if (!skip_vert) { |
| 1122 this->lineTo(rect.fLeft, rect.fBottom - ry); // left | 1120 this->lineTo(rect.fLeft, rect.fBottom - ry); // left |
| 1123 } | 1121 } |
| 1124 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT | 1122 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT |
| 1125 this->cubicTo(rect.fLeft, rect.fBottom - ry + sy, | 1123 this->cubicTo(rect.fLeft, rect.fBottom - ry + sy, |
| 1126 rect.fLeft + rx - sx, rect.fBottom, | 1124 rect.fLeft + rx - sx, rect.fBottom, |
| 1127 rect.fLeft + rx, rect.fBottom); // bot-left | 1125 rect.fLeft + rx, rect.fBottom); // bot-left |
| 1128 #else | 1126 #else |
| 1129 this->quadTo(rect.fLeft + kOffCurveEpsilon, rect.fBottom - ry + offPtY, | 1127 this->quadTo(rect.fLeft, rect.fBottom - ry + offPtY, |
| 1130 rect.fLeft + rx - midPtX, rect.fBottom - ry + midPtY); | 1128 rect.fLeft + rx - midPtX, rect.fBottom - ry + midPtY); |
| 1131 this->quadTo(rect.fLeft + rx - offPtX, rect.fBottom - kOffCurveEpsilon, | 1129 this->quadTo(rect.fLeft + rx - offPtX, rect.fBottom, |
| 1132 rect.fLeft + rx, rect.fBottom); | 1130 rect.fLeft + rx, rect.fBottom); |
| 1133 #endif | 1131 #endif |
| 1134 if (!skip_hori) { | 1132 if (!skip_hori) { |
| 1135 this->lineTo(rect.fRight - rx, rect.fBottom); // bottom | 1133 this->lineTo(rect.fRight - rx, rect.fBottom); // bottom |
| 1136 } | 1134 } |
| 1137 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT | 1135 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT |
| 1138 this->cubicTo(rect.fRight - rx + sx, rect.fBottom, | 1136 this->cubicTo(rect.fRight - rx + sx, rect.fBottom, |
| 1139 rect.fRight, rect.fBottom - ry + sy, | 1137 rect.fRight, rect.fBottom - ry + sy, |
| 1140 rect.fRight, rect.fBottom - ry); // bot-right | 1138 rect.fRight, rect.fBottom - ry); // bot-right |
| 1141 #else | 1139 #else |
| 1142 this->quadTo(rect.fRight - rx + offPtX, rect.fBottom - kOffCurveEpsilon, | 1140 this->quadTo(rect.fRight - rx + offPtX, rect.fBottom, |
| 1143 rect.fRight - rx + midPtX, rect.fBottom - ry + midPtY); | 1141 rect.fRight - rx + midPtX, rect.fBottom - ry + midPtY); |
| 1144 this->quadTo(rect.fRight - kOffCurveEpsilon, rect.fBottom - ry + offPtY, | 1142 this->quadTo(rect.fRight, rect.fBottom - ry + offPtY, |
| 1145 rect.fRight, rect.fBottom - ry); | 1143 rect.fRight, rect.fBottom - ry); |
| 1146 #endif | 1144 #endif |
| 1147 if (!skip_vert) { | 1145 if (!skip_vert) { |
| 1148 this->lineTo(rect.fRight, rect.fTop + ry); // right | 1146 this->lineTo(rect.fRight, rect.fTop + ry); // right |
| 1149 } | 1147 } |
| 1150 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT | 1148 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT |
| 1151 this->cubicTo(rect.fRight, rect.fTop + ry - sy, | 1149 this->cubicTo(rect.fRight, rect.fTop + ry - sy, |
| 1152 rect.fRight - rx + sx, rect.fTop, | 1150 rect.fRight - rx + sx, rect.fTop, |
| 1153 rect.fRight - rx, rect.fTop); // top-right | 1151 rect.fRight - rx, rect.fTop); // top-right |
| 1154 #else | 1152 #else |
| 1155 this->quadTo(rect.fRight - kOffCurveEpsilon, rect.fTop + ry - offPtY, | 1153 this->quadTo(rect.fRight, rect.fTop + ry - offPtY, |
| 1156 rect.fRight - rx + midPtX, rect.fTop + ry - midPtY); | 1154 rect.fRight - rx + midPtX, rect.fTop + ry - midPtY); |
| 1157 this->quadTo(rect.fRight - rx + offPtX, rect.fTop + kOffCurveEpsilon, | 1155 this->quadTo(rect.fRight - rx + offPtX, rect.fTop, |
| 1158 rect.fRight - rx, rect.fTop); | 1156 rect.fRight - rx, rect.fTop); |
| 1159 #endif | 1157 #endif |
| 1160 } else { | 1158 } else { |
| 1161 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT | 1159 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT |
| 1162 this->cubicTo(rect.fRight - rx + sx, rect.fTop, | 1160 this->cubicTo(rect.fRight - rx + sx, rect.fTop, |
| 1163 rect.fRight, rect.fTop + ry - sy, | 1161 rect.fRight, rect.fTop + ry - sy, |
| 1164 rect.fRight, rect.fTop + ry); // top-right | 1162 rect.fRight, rect.fTop + ry); // top-right |
| 1165 #else | 1163 #else |
| 1166 this->quadTo(rect.fRight - rx + offPtX, rect.fTop + kOffCurveEpsilon, | 1164 this->quadTo(rect.fRight - rx + offPtX, rect.fTop, |
| 1167 rect.fRight - rx + midPtX, rect.fTop + ry - midPtY); | 1165 rect.fRight - rx + midPtX, rect.fTop + ry - midPtY); |
| 1168 this->quadTo(rect.fRight - kOffCurveEpsilon, rect.fTop + ry - offPtY, | 1166 this->quadTo(rect.fRight, rect.fTop + ry - offPtY, |
| 1169 rect.fRight, rect.fTop + ry); | 1167 rect.fRight, rect.fTop + ry); |
| 1170 #endif | 1168 #endif |
| 1171 if (!skip_vert) { | 1169 if (!skip_vert) { |
| 1172 this->lineTo(rect.fRight, rect.fBottom - ry); // right | 1170 this->lineTo(rect.fRight, rect.fBottom - ry); // right |
| 1173 } | 1171 } |
| 1174 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT | 1172 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT |
| 1175 this->cubicTo(rect.fRight, rect.fBottom - ry + sy, | 1173 this->cubicTo(rect.fRight, rect.fBottom - ry + sy, |
| 1176 rect.fRight - rx + sx, rect.fBottom, | 1174 rect.fRight - rx + sx, rect.fBottom, |
| 1177 rect.fRight - rx, rect.fBottom); // bot-right | 1175 rect.fRight - rx, rect.fBottom); // bot-right |
| 1178 #else | 1176 #else |
| 1179 this->quadTo(rect.fRight - kOffCurveEpsilon, rect.fBottom - ry + offPtY, | 1177 this->quadTo(rect.fRight, rect.fBottom - ry + offPtY, |
| 1180 rect.fRight - rx + midPtX, rect.fBottom - ry + midPtY); | 1178 rect.fRight - rx + midPtX, rect.fBottom - ry + midPtY); |
| 1181 this->quadTo(rect.fRight - rx + offPtX, rect.fBottom - kOffCurveEpsilon, | 1179 this->quadTo(rect.fRight - rx + offPtX, rect.fBottom, |
| 1182 rect.fRight - rx, rect.fBottom); | 1180 rect.fRight - rx, rect.fBottom); |
| 1183 #endif | 1181 #endif |
| 1184 if (!skip_hori) { | 1182 if (!skip_hori) { |
| 1185 this->lineTo(rect.fLeft + rx, rect.fBottom); // bottom | 1183 this->lineTo(rect.fLeft + rx, rect.fBottom); // bottom |
| 1186 } | 1184 } |
| 1187 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT | 1185 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT |
| 1188 this->cubicTo(rect.fLeft + rx - sx, rect.fBottom, | 1186 this->cubicTo(rect.fLeft + rx - sx, rect.fBottom, |
| 1189 rect.fLeft, rect.fBottom - ry + sy, | 1187 rect.fLeft, rect.fBottom - ry + sy, |
| 1190 rect.fLeft, rect.fBottom - ry); // bot-left | 1188 rect.fLeft, rect.fBottom - ry); // bot-left |
| 1191 #else | 1189 #else |
| 1192 this->quadTo(rect.fLeft + rx - offPtX, rect.fBottom - kOffCurveEpsilon, | 1190 this->quadTo(rect.fLeft + rx - offPtX, rect.fBottom, |
| 1193 rect.fLeft + rx - midPtX, rect.fBottom - ry + midPtY); | 1191 rect.fLeft + rx - midPtX, rect.fBottom - ry + midPtY); |
| 1194 this->quadTo(rect.fLeft + kOffCurveEpsilon, rect.fBottom - ry + offPtY, | 1192 this->quadTo(rect.fLeft, rect.fBottom - ry + offPtY, |
| 1195 rect.fLeft, rect.fBottom - ry); | 1193 rect.fLeft, rect.fBottom - ry); |
| 1196 #endif | 1194 #endif |
| 1197 if (!skip_vert) { | 1195 if (!skip_vert) { |
| 1198 this->lineTo(rect.fLeft, rect.fTop + ry); // left | 1196 this->lineTo(rect.fLeft, rect.fTop + ry); // left |
| 1199 } | 1197 } |
| 1200 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT | 1198 #ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT |
| 1201 this->cubicTo(rect.fLeft, rect.fTop + ry - sy, | 1199 this->cubicTo(rect.fLeft, rect.fTop + ry - sy, |
| 1202 rect.fLeft + rx - sx, rect.fTop, | 1200 rect.fLeft + rx - sx, rect.fTop, |
| 1203 rect.fLeft + rx, rect.fTop); // top-left | 1201 rect.fLeft + rx, rect.fTop); // top-left |
| 1204 #else | 1202 #else |
| 1205 this->quadTo(rect.fLeft + kOffCurveEpsilon, rect.fTop + ry - offPtY, | 1203 this->quadTo(rect.fLeft, rect.fTop + ry - offPtY, |
| 1206 rect.fLeft + rx - midPtX, rect.fTop + ry - midPtY); | 1204 rect.fLeft + rx - midPtX, rect.fTop + ry - midPtY); |
| 1207 this->quadTo(rect.fLeft + rx - offPtX, rect.fTop + kOffCurveEpsilon, | 1205 this->quadTo(rect.fLeft + rx - offPtX, rect.fTop, |
| 1208 rect.fLeft + rx, rect.fTop); | 1206 rect.fLeft + rx, rect.fTop); |
| 1209 #endif | 1207 #endif |
| 1210 if (!skip_hori) { | 1208 if (!skip_hori) { |
| 1211 this->lineTo(rect.fRight - rx, rect.fTop); // top | 1209 this->lineTo(rect.fRight - rx, rect.fTop); // top |
| 1212 } | 1210 } |
| 1213 } | 1211 } |
| 1214 this->close(); | 1212 this->close(); |
| 1215 } | 1213 } |
| 1216 | 1214 |
| 1217 void SkPath::addOval(const SkRect& oval, Direction dir) { | 1215 void SkPath::addOval(const SkRect& oval, Direction dir) { |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2256 SkASSERT(mask == fSegmentMask); | 2254 SkASSERT(mask == fSegmentMask); |
| 2257 #endif // SK_DEBUG_PATH | 2255 #endif // SK_DEBUG_PATH |
| 2258 } | 2256 } |
| 2259 #endif // SK_DEBUG | 2257 #endif // SK_DEBUG |
| 2260 | 2258 |
| 2261 /////////////////////////////////////////////////////////////////////////////// | 2259 /////////////////////////////////////////////////////////////////////////////// |
| 2262 | 2260 |
| 2263 static int sign(SkScalar x) { return x < 0; } | 2261 static int sign(SkScalar x) { return x < 0; } |
| 2264 #define kValueNeverReturnedBySign 2 | 2262 #define kValueNeverReturnedBySign 2 |
| 2265 | 2263 |
| 2266 static int CrossProductSign(const SkVector& a, const SkVector& b) { | 2264 static bool AlmostEqual(SkScalar compA, SkScalar compB) { |
|
scroggo
2013/11/01 16:04:10
Is this deliberately different from SkScalarNearly
| |
| 2267 return SkScalarSignAsInt(SkPoint::CrossProduct(a, b)); | 2265 // The error epsilon was empirically derived; worse case round rects |
| 2266 // with a mid point outset by 2x float epsilon in tests had an error | |
| 2267 // of 12. | |
| 2268 const int epsilon = 16; | |
| 2269 if (!SkScalarIsFinite(compA) || !SkScalarIsFinite(compB)) { | |
| 2270 return false; | |
| 2271 } | |
| 2272 if (sk_float_abs(compA) <= FLT_EPSILON && sk_float_abs(compB) <= FLT_EPSILON ) { | |
| 2273 return true; | |
| 2274 } | |
| 2275 int aBits = SkFloatAs2sCompliment(compA); | |
| 2276 int bBits = SkFloatAs2sCompliment(compB); | |
| 2277 return aBits < bBits + epsilon && bBits < aBits + epsilon; | |
| 2268 } | 2278 } |
| 2269 | 2279 |
| 2270 // only valid for a single contour | 2280 // only valid for a single contour |
| 2271 struct Convexicator { | 2281 struct Convexicator { |
| 2272 Convexicator() | 2282 Convexicator() |
| 2273 : fPtCount(0) | 2283 : fPtCount(0) |
| 2274 , fConvexity(SkPath::kConvex_Convexity) | 2284 , fConvexity(SkPath::kConvex_Convexity) |
| 2275 , fDirection(SkPath::kUnknown_Direction) { | 2285 , fDirection(SkPath::kUnknown_Direction) { |
| 2276 fSign = 0; | 2286 fSign = 0; |
| 2277 // warnings | 2287 // warnings |
| 2288 fLastPt.set(0, 0); | |
| 2278 fCurrPt.set(0, 0); | 2289 fCurrPt.set(0, 0); |
| 2279 fVec0.set(0, 0); | 2290 fVec0.set(0, 0); |
| 2280 fVec1.set(0, 0); | 2291 fVec1.set(0, 0); |
| 2281 fFirstVec.set(0, 0); | 2292 fFirstVec.set(0, 0); |
| 2282 | 2293 |
| 2283 fDx = fDy = 0; | 2294 fDx = fDy = 0; |
| 2284 fSx = fSy = kValueNeverReturnedBySign; | 2295 fSx = fSy = kValueNeverReturnedBySign; |
| 2285 } | 2296 } |
| 2286 | 2297 |
| 2287 SkPath::Convexity getConvexity() const { return fConvexity; } | 2298 SkPath::Convexity getConvexity() const { return fConvexity; } |
| 2288 | 2299 |
| 2289 /** The direction returned is only valid if the path is determined convex */ | 2300 /** The direction returned is only valid if the path is determined convex */ |
| 2290 SkPath::Direction getDirection() const { return fDirection; } | 2301 SkPath::Direction getDirection() const { return fDirection; } |
| 2291 | 2302 |
| 2292 void addPt(const SkPoint& pt) { | 2303 void addPt(const SkPoint& pt) { |
| 2293 if (SkPath::kConcave_Convexity == fConvexity) { | 2304 if (SkPath::kConcave_Convexity == fConvexity) { |
| 2294 return; | 2305 return; |
| 2295 } | 2306 } |
| 2296 | 2307 |
| 2297 if (0 == fPtCount) { | 2308 if (0 == fPtCount) { |
| 2298 fCurrPt = pt; | 2309 fCurrPt = pt; |
| 2299 ++fPtCount; | 2310 ++fPtCount; |
| 2300 } else { | 2311 } else { |
| 2301 SkVector vec = pt - fCurrPt; | 2312 SkVector vec = pt - fCurrPt; |
| 2302 if (vec.fX || vec.fY) { | 2313 if (vec.fX || vec.fY) { |
| 2314 fLastPt = fCurrPt; | |
| 2303 fCurrPt = pt; | 2315 fCurrPt = pt; |
| 2304 if (++fPtCount == 2) { | 2316 if (++fPtCount == 2) { |
| 2305 fFirstVec = fVec1 = vec; | 2317 fFirstVec = fVec1 = vec; |
| 2306 } else { | 2318 } else { |
| 2307 SkASSERT(fPtCount > 2); | 2319 SkASSERT(fPtCount > 2); |
| 2308 this->addVec(vec); | 2320 this->addVec(vec); |
| 2309 } | 2321 } |
| 2310 | 2322 |
| 2311 int sx = sign(vec.fX); | 2323 int sx = sign(vec.fX); |
| 2312 int sy = sign(vec.fY); | 2324 int sy = sign(vec.fY); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 2326 if (fPtCount > 2) { | 2338 if (fPtCount > 2) { |
| 2327 this->addVec(fFirstVec); | 2339 this->addVec(fFirstVec); |
| 2328 } | 2340 } |
| 2329 } | 2341 } |
| 2330 | 2342 |
| 2331 private: | 2343 private: |
| 2332 void addVec(const SkVector& vec) { | 2344 void addVec(const SkVector& vec) { |
| 2333 SkASSERT(vec.fX || vec.fY); | 2345 SkASSERT(vec.fX || vec.fY); |
| 2334 fVec0 = fVec1; | 2346 fVec0 = fVec1; |
| 2335 fVec1 = vec; | 2347 fVec1 = vec; |
| 2336 int sign = CrossProductSign(fVec0, fVec1); | 2348 SkScalar cross = SkPoint::CrossProduct(fVec0, fVec1); |
| 2349 SkScalar smallest = SkTMin(fCurrPt.fX, SkTMin(fCurrPt.fY, SkTMin(fLastPt .fX, fLastPt.fY))); | |
| 2350 SkScalar largest = SkTMax(fCurrPt.fX, SkTMax(fCurrPt.fY, SkTMax(fLastPt. fX, fLastPt.fY))); | |
| 2351 largest = SkTMax(largest, -smallest); | |
| 2352 int sign = AlmostEqual(largest, largest + cross) ? 0 : SkScalarSignAsInt (cross); | |
| 2337 if (0 == fSign) { | 2353 if (0 == fSign) { |
| 2338 fSign = sign; | 2354 fSign = sign; |
| 2339 if (1 == sign) { | 2355 if (1 == sign) { |
| 2340 fDirection = SkPath::kCW_Direction; | 2356 fDirection = SkPath::kCW_Direction; |
| 2341 } else if (-1 == sign) { | 2357 } else if (-1 == sign) { |
| 2342 fDirection = SkPath::kCCW_Direction; | 2358 fDirection = SkPath::kCCW_Direction; |
| 2343 } | 2359 } |
| 2344 } else if (sign) { | 2360 } else if (sign) { |
| 2345 if (fSign != sign) { | 2361 if (fSign != sign) { |
| 2346 fConvexity = SkPath::kConcave_Convexity; | 2362 fConvexity = SkPath::kConcave_Convexity; |
| 2347 fDirection = SkPath::kUnknown_Direction; | 2363 fDirection = SkPath::kUnknown_Direction; |
| 2348 } | 2364 } |
| 2349 } | 2365 } |
| 2350 } | 2366 } |
| 2351 | 2367 |
| 2368 SkPoint fLastPt; | |
| 2352 SkPoint fCurrPt; | 2369 SkPoint fCurrPt; |
| 2353 SkVector fVec0, fVec1, fFirstVec; | 2370 SkVector fVec0, fVec1, fFirstVec; |
| 2354 int fPtCount; // non-degenerate points | 2371 int fPtCount; // non-degenerate points |
| 2355 int fSign; | 2372 int fSign; |
| 2356 SkPath::Convexity fConvexity; | 2373 SkPath::Convexity fConvexity; |
| 2357 SkPath::Direction fDirection; | 2374 SkPath::Direction fDirection; |
| 2358 int fDx, fDy, fSx, fSy; | 2375 int fDx, fDy, fSx, fSy; |
| 2359 }; | 2376 }; |
| 2360 | 2377 |
| 2361 SkPath::Convexity SkPath::internalGetConvexity() const { | 2378 SkPath::Convexity SkPath::internalGetConvexity() const { |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2985 switch (this->getFillType()) { | 3002 switch (this->getFillType()) { |
| 2986 case SkPath::kEvenOdd_FillType: | 3003 case SkPath::kEvenOdd_FillType: |
| 2987 case SkPath::kInverseEvenOdd_FillType: | 3004 case SkPath::kInverseEvenOdd_FillType: |
| 2988 w &= 1; | 3005 w &= 1; |
| 2989 break; | 3006 break; |
| 2990 default: | 3007 default: |
| 2991 break; | 3008 break; |
| 2992 } | 3009 } |
| 2993 return SkToBool(w); | 3010 return SkToBool(w); |
| 2994 } | 3011 } |
| OLD | NEW |