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 "SkStrokerPriv.h" | 10 #include "SkStrokerPriv.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (count > 1) | 146 if (count > 1) |
147 { | 147 { |
148 for (int i = 1; i < count; i += 2) | 148 for (int i = 1; i < count; i += 2) |
149 outer->quadTo(pts[i].fX, pts[i].fY, pts[i+1].fX, pts[i+1].fY); | 149 outer->quadTo(pts[i].fX, pts[i].fY, pts[i+1].fX, pts[i+1].fY); |
150 | 150 |
151 after.scale(radius); | 151 after.scale(radius); |
152 HandleInnerJoin(inner, pivot, after); | 152 HandleInnerJoin(inner, pivot, after); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 #ifdef SK_SCALAR_IS_FLOAT | 156 #define kOneOverSqrt2 (0.707106781f) |
157 #define kOneOverSqrt2 (0.707106781f) | |
158 #else | |
159 #define kOneOverSqrt2 (46341) | |
160 #endif | |
161 | 157 |
162 static void MiterJoiner(SkPath* outer, SkPath* inner, const SkVector& beforeUnit
Normal, | 158 static void MiterJoiner(SkPath* outer, SkPath* inner, const SkVector& beforeUnit
Normal, |
163 const SkPoint& pivot, const SkVector& afterUnitNormal, | 159 const SkPoint& pivot, const SkVector& afterUnitNormal, |
164 SkScalar radius, SkScalar invMiterLimit, | 160 SkScalar radius, SkScalar invMiterLimit, |
165 bool prevIsLine, bool currIsLine) | 161 bool prevIsLine, bool currIsLine) |
166 { | 162 { |
167 // negate the dot since we're using normals instead of tangents | 163 // negate the dot since we're using normals instead of tangents |
168 SkScalar dotProd = SkPoint::DotProduct(beforeUnitNormal, afterUnitNormal)
; | 164 SkScalar dotProd = SkPoint::DotProduct(beforeUnitNormal, afterUnitNormal)
; |
169 AngleType angleType = Dot2AngleType(dotProd); | 165 AngleType angleType = Dot2AngleType(dotProd); |
170 SkVector before = beforeUnitNormal; | 166 SkVector before = beforeUnitNormal; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 251 |
256 SkStrokerPriv::JoinProc SkStrokerPriv::JoinFactory(SkPaint::Join join) | 252 SkStrokerPriv::JoinProc SkStrokerPriv::JoinFactory(SkPaint::Join join) |
257 { | 253 { |
258 static const SkStrokerPriv::JoinProc gJoiners[] = { | 254 static const SkStrokerPriv::JoinProc gJoiners[] = { |
259 MiterJoiner, RoundJoiner, BluntJoiner | 255 MiterJoiner, RoundJoiner, BluntJoiner |
260 }; | 256 }; |
261 | 257 |
262 SkASSERT((unsigned)join < SkPaint::kJoinCount); | 258 SkASSERT((unsigned)join < SkPaint::kJoinCount); |
263 return gJoiners[join]; | 259 return gJoiners[join]; |
264 } | 260 } |
OLD | NEW |