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 "SkBuffer.h" | 8 #include "SkBuffer.h" |
9 #include "SkCubicClipper.h" | 9 #include "SkCubicClipper.h" |
10 #include "SkErrorInternals.h" | 10 #include "SkErrorInternals.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 SkTSwap<uint8_t>(fFillType, that.fFillType); | 186 SkTSwap<uint8_t>(fFillType, that.fFillType); |
187 SkTSwap<uint8_t>(fConvexity, that.fConvexity); | 187 SkTSwap<uint8_t>(fConvexity, that.fConvexity); |
188 // Simulate SkTSwap<uint8_t>(fFirstDirection, that.fFirstDirection); | 188 // Simulate SkTSwap<uint8_t>(fFirstDirection, that.fFirstDirection); |
189 uint8_t temp = fFirstDirection; | 189 uint8_t temp = fFirstDirection; |
190 fFirstDirection.store(that.fFirstDirection.load()); | 190 fFirstDirection.store(that.fFirstDirection.load()); |
191 that.fFirstDirection.store(temp); | 191 that.fFirstDirection.store(temp); |
192 SkTSwap<SkBool8>(fIsVolatile, that.fIsVolatile); | 192 SkTSwap<SkBool8>(fIsVolatile, that.fIsVolatile); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 bool SkPath::isInterpolatable(const SkPath& compare) const { | |
197 int count = fPathRef->countVerbs(); | |
198 if (count != compare.fPathRef->countVerbs()) { | |
199 return false; | |
200 } | |
201 if (!count) { | |
202 return true; | |
203 } | |
204 if (memcmp(fPathRef->verbsMemBegin(), compare.fPathRef->verbsMemBegin(), | |
robertphillips
2016/02/17 21:08:49
line 'count' up with the '(' ?
caryclark
2016/02/17 21:39:21
Done.
| |
205 count)) { | |
206 return false; | |
207 } | |
robertphillips
2016/02/17 21:08:49
Shouldn't these be conicWeights not verbsMemBegin
caryclark
2016/02/17 21:39:21
Aack! I blame ctrl-v. (Done)
| |
208 return !SkToBool(memcmp(fPathRef->verbsMemBegin(), compare.fPathRef->verbsMe mBegin(), | |
robertphillips
2016/02/17 21:08:49
just countWeights() ?
caryclark
2016/02/17 21:39:21
Done.
| |
209 (char* ) fPathRef->conicWeightsEnd() - (char* ) fPathRef->conicWeigh ts())); | |
210 } | |
211 | |
212 bool SkPath::interpolate(const SkPath& ending, SkScalar weight, SkPath* out) con st { | |
213 int verbCount = fPathRef->countVerbs(); | |
214 if (verbCount != ending.fPathRef->countVerbs()) { | |
215 return false; | |
216 } | |
217 out->reset(); | |
218 out->addPath(*this); | |
219 fPathRef->interpolate(*ending.fPathRef, weight, out->fPathRef); | |
220 return true; | |
221 } | |
222 | |
196 static inline bool check_edge_against_rect(const SkPoint& p0, | 223 static inline bool check_edge_against_rect(const SkPoint& p0, |
197 const SkPoint& p1, | 224 const SkPoint& p1, |
198 const SkRect& rect, | 225 const SkRect& rect, |
199 SkPathPriv::FirstDirection dir) { | 226 SkPathPriv::FirstDirection dir) { |
200 const SkPoint* edgeBegin; | 227 const SkPoint* edgeBegin; |
201 SkVector v; | 228 SkVector v; |
202 if (SkPathPriv::kCW_FirstDirection == dir) { | 229 if (SkPathPriv::kCW_FirstDirection == dir) { |
203 v = p1 - p0; | 230 v = p1 - p0; |
204 edgeBegin = &p0; | 231 edgeBegin = &p0; |
205 } else { | 232 } else { |
(...skipping 2969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3175 } | 3202 } |
3176 } while (!done); | 3203 } while (!done); |
3177 return SkToBool(tangents.count()) ^ isInverse; | 3204 return SkToBool(tangents.count()) ^ isInverse; |
3178 } | 3205 } |
3179 | 3206 |
3180 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2, | 3207 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2, |
3181 SkScalar w, SkPoint pts[], int pow2) { | 3208 SkScalar w, SkPoint pts[], int pow2) { |
3182 const SkConic conic(p0, p1, p2, w); | 3209 const SkConic conic(p0, p1, p2, w); |
3183 return conic.chopIntoQuadsPOW2(pts, pow2); | 3210 return conic.chopIntoQuadsPOW2(pts, pow2); |
3184 } | 3211 } |
OLD | NEW |