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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 fDirection = kUnknown_Direction; | 178 fDirection = kUnknown_Direction; |
179 fIsFinite = false; | 179 fIsFinite = false; |
180 fIsOval = false; | 180 fIsOval = false; |
181 #ifdef SK_BUILD_FOR_ANDROID | 181 #ifdef SK_BUILD_FOR_ANDROID |
182 GEN_ID_INC; | 182 GEN_ID_INC; |
183 fSourcePath = NULL; | 183 fSourcePath = NULL; |
184 #endif | 184 #endif |
185 } | 185 } |
186 | 186 |
187 SkPath::SkPath(const SkPath& that) | 187 SkPath::SkPath(const SkPath& that) |
188 : fPathRef(SkRef(that.fPathRef.get())) | 188 : fPathRef(SkRef(that.fPathRef.get())) { |
189 #ifdef SK_BUILD_FOR_ANDROID | |
190 , fGenerationID(0) | |
191 #endif | |
192 { | |
193 this->copyFields(that); | 189 this->copyFields(that); |
194 SkDEBUGCODE(that.validate();) | 190 SkDEBUGCODE(that.validate();) |
195 } | 191 } |
196 | 192 |
197 SkPath::~SkPath() { | 193 SkPath::~SkPath() { |
198 SkDEBUGCODE(this->validate();) | 194 SkDEBUGCODE(this->validate();) |
199 } | 195 } |
200 | 196 |
201 SkPath& SkPath::operator=(const SkPath& that) { | 197 SkPath& SkPath::operator=(const SkPath& that) { |
202 SkDEBUGCODE(that.validate();) | 198 SkDEBUGCODE(that.validate();) |
(...skipping 11 matching lines...) Expand all Loading... | |
214 fBounds = that.fBounds; | 210 fBounds = that.fBounds; |
215 fLastMoveToIndex = that.fLastMoveToIndex; | 211 fLastMoveToIndex = that.fLastMoveToIndex; |
216 fFillType = that.fFillType; | 212 fFillType = that.fFillType; |
217 fSegmentMask = that.fSegmentMask; | 213 fSegmentMask = that.fSegmentMask; |
218 fBoundsIsDirty = that.fBoundsIsDirty; | 214 fBoundsIsDirty = that.fBoundsIsDirty; |
219 fConvexity = that.fConvexity; | 215 fConvexity = that.fConvexity; |
220 fDirection = that.fDirection; | 216 fDirection = that.fDirection; |
221 fIsFinite = that.fIsFinite; | 217 fIsFinite = that.fIsFinite; |
222 fIsOval = that.fIsOval; | 218 fIsOval = that.fIsOval; |
223 #ifdef SK_BUILD_FOR_ANDROID | 219 #ifdef SK_BUILD_FOR_ANDROID |
224 GEN_ID_INC; | 220 fGenerationID = that.fGenerationID; |
bungeman-skia
2013/08/06 20:09:48
Similar situation to swap. Can't this make this ob
mtklein
2013/08/06 20:23:35
Done.
| |
225 fSourcePath = NULL; | 221 fSourcePath = NULL; // TODO(mtklein): follow up with Android: do we wa nt to copy this too? |
226 #endif | 222 #endif |
227 } | 223 } |
228 | 224 |
229 SK_API bool operator==(const SkPath& a, const SkPath& b) { | 225 SK_API bool operator==(const SkPath& a, const SkPath& b) { |
230 // note: don't need to look at isConvex or bounds, since just comparing the | 226 // note: don't need to look at isConvex or bounds, since just comparing the |
231 // raw data is sufficient. | 227 // raw data is sufficient. |
232 | 228 |
233 // We explicitly check fSegmentMask as a quick-reject. We could skip it, | 229 // We explicitly check fSegmentMask as a quick-reject. We could skip it, |
234 // since it is only a cache of info in the fVerbs, but its a fast way to | 230 // since it is only a cache of info in the fVerbs, but its a fast way to |
235 // notice a difference | 231 // notice a difference |
(...skipping 10 matching lines...) Expand all Loading... | |
246 fPathRef.swap(&that.fPathRef); | 242 fPathRef.swap(&that.fPathRef); |
247 SkTSwap<SkRect>(fBounds, that.fBounds); | 243 SkTSwap<SkRect>(fBounds, that.fBounds); |
248 SkTSwap<int>(fLastMoveToIndex, that.fLastMoveToIndex); | 244 SkTSwap<int>(fLastMoveToIndex, that.fLastMoveToIndex); |
249 SkTSwap<uint8_t>(fFillType, that.fFillType); | 245 SkTSwap<uint8_t>(fFillType, that.fFillType); |
250 SkTSwap<uint8_t>(fSegmentMask, that.fSegmentMask); | 246 SkTSwap<uint8_t>(fSegmentMask, that.fSegmentMask); |
251 SkTSwap<uint8_t>(fBoundsIsDirty, that.fBoundsIsDirty); | 247 SkTSwap<uint8_t>(fBoundsIsDirty, that.fBoundsIsDirty); |
252 SkTSwap<uint8_t>(fConvexity, that.fConvexity); | 248 SkTSwap<uint8_t>(fConvexity, that.fConvexity); |
253 SkTSwap<uint8_t>(fDirection, that.fDirection); | 249 SkTSwap<uint8_t>(fDirection, that.fDirection); |
254 SkTSwap<SkBool8>(fIsFinite, that.fIsFinite); | 250 SkTSwap<SkBool8>(fIsFinite, that.fIsFinite); |
255 SkTSwap<SkBool8>(fIsOval, that.fIsOval); | 251 SkTSwap<SkBool8>(fIsOval, that.fIsOval); |
252 #ifdef SK_BUILD_FOR_ANDROID | |
253 // It doesn't really make sense to swap the generation IDs here, because they might go | |
254 // backwards. To be safe we increment both to mark them both as changed . | |
256 GEN_ID_INC; | 255 GEN_ID_INC; |
257 GEN_ID_PTR_INC(&that); | 256 GEN_ID_PTR_INC(&that); |
257 SkTSwap<SkPath*>(fSourcePath, that.fSourcePath); | |
258 #endif | |
258 } | 259 } |
259 } | 260 } |
260 | 261 |
261 static inline bool check_edge_against_rect(const SkPoint& p0, | 262 static inline bool check_edge_against_rect(const SkPoint& p0, |
262 const SkPoint& p1, | 263 const SkPoint& p1, |
263 const SkRect& rect, | 264 const SkRect& rect, |
264 SkPath::Direction dir) { | 265 SkPath::Direction dir) { |
265 const SkPoint* edgeBegin; | 266 const SkPoint* edgeBegin; |
266 SkVector v; | 267 SkVector v; |
267 if (SkPath::kCW_Direction == dir) { | 268 if (SkPath::kCW_Direction == dir) { |
(...skipping 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2995 switch (this->getFillType()) { | 2996 switch (this->getFillType()) { |
2996 case SkPath::kEvenOdd_FillType: | 2997 case SkPath::kEvenOdd_FillType: |
2997 case SkPath::kInverseEvenOdd_FillType: | 2998 case SkPath::kInverseEvenOdd_FillType: |
2998 w &= 1; | 2999 w &= 1; |
2999 break; | 3000 break; |
3000 default: | 3001 default: |
3001 break; | 3002 break; |
3002 } | 3003 } |
3003 return SkToBool(w); | 3004 return SkToBool(w); |
3004 } | 3005 } |
OLD | NEW |