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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 fLastMoveToIndex = INITIAL_LASTMOVETOINDEX_VALUE; | 173 fLastMoveToIndex = INITIAL_LASTMOVETOINDEX_VALUE; |
174 fFillType = kWinding_FillType; | 174 fFillType = kWinding_FillType; |
175 fSegmentMask = 0; | 175 fSegmentMask = 0; |
176 fBoundsIsDirty = true; | 176 fBoundsIsDirty = true; |
177 fConvexity = kUnknown_Convexity; | 177 fConvexity = kUnknown_Convexity; |
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 // We don't touch fSourcePath. It's used to track texture garbage collectio
n, so we don't |
| 184 // want to muck with it if it's been set to something non-NULL. |
184 #endif | 185 #endif |
185 } | 186 } |
186 | 187 |
187 SkPath::SkPath(const SkPath& that) | 188 SkPath::SkPath(const SkPath& that) |
188 : fPathRef(SkRef(that.fPathRef.get())) { | 189 : fPathRef(SkRef(that.fPathRef.get())) { |
189 this->copyFields(that); | 190 this->copyFields(that); |
190 #ifdef SK_BUILD_FOR_ANDROID | 191 #ifdef SK_BUILD_FOR_ANDROID |
191 fGenerationID = that.fGenerationID; | 192 fGenerationID = that.fGenerationID; |
192 fSourcePath = NULL; // TODO(mtklein): follow up with Android: do we want
to copy this too? | 193 fSourcePath = that.fSourcePath; |
193 #endif | 194 #endif |
194 SkDEBUGCODE(that.validate();) | 195 SkDEBUGCODE(that.validate();) |
195 } | 196 } |
196 | 197 |
197 SkPath::~SkPath() { | 198 SkPath::~SkPath() { |
198 SkDEBUGCODE(this->validate();) | 199 SkDEBUGCODE(this->validate();) |
199 } | 200 } |
200 | 201 |
201 SkPath& SkPath::operator=(const SkPath& that) { | 202 SkPath& SkPath::operator=(const SkPath& that) { |
202 SkDEBUGCODE(that.validate();) | 203 SkDEBUGCODE(that.validate();) |
203 | 204 |
204 if (this != &that) { | 205 if (this != &that) { |
205 fPathRef.reset(SkRef(that.fPathRef.get())); | 206 fPathRef.reset(SkRef(that.fPathRef.get())); |
206 this->copyFields(that); | 207 this->copyFields(that); |
207 #ifdef SK_BUILD_FOR_ANDROID | 208 #ifdef SK_BUILD_FOR_ANDROID |
208 GEN_ID_INC; // Similar to swap, we can't just copy this or it could go
back in time. | 209 GEN_ID_INC; // Similar to swap, we can't just copy this or it could go
back in time. |
209 fSourcePath = NULL; // TODO(mtklein): follow up with Android: do we wan
t to copy this too? | 210 fSourcePath = that.fSourcePath; |
210 #endif | 211 #endif |
211 } | 212 } |
212 SkDEBUGCODE(this->validate();) | 213 SkDEBUGCODE(this->validate();) |
213 return *this; | 214 return *this; |
214 } | 215 } |
215 | 216 |
216 void SkPath::copyFields(const SkPath& that) { | 217 void SkPath::copyFields(const SkPath& that) { |
217 //fPathRef is assumed to have been set by the caller. | 218 //fPathRef is assumed to have been set by the caller. |
218 fBounds = that.fBounds; | 219 fBounds = that.fBounds; |
219 fLastMoveToIndex = that.fLastMoveToIndex; | 220 fLastMoveToIndex = that.fLastMoveToIndex; |
(...skipping 2784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 switch (this->getFillType()) { | 3005 switch (this->getFillType()) { |
3005 case SkPath::kEvenOdd_FillType: | 3006 case SkPath::kEvenOdd_FillType: |
3006 case SkPath::kInverseEvenOdd_FillType: | 3007 case SkPath::kInverseEvenOdd_FillType: |
3007 w &= 1; | 3008 w &= 1; |
3008 break; | 3009 break; |
3009 default: | 3010 default: |
3010 break; | 3011 break; |
3011 } | 3012 } |
3012 return SkToBool(w); | 3013 return SkToBool(w); |
3013 } | 3014 } |
OLD | NEW |