OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
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 #ifndef SkPathRef_DEFINED | 9 #ifndef SkPathRef_DEFINED |
10 #define SkPathRef_DEFINED | 10 #define SkPathRef_DEFINED |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 }; | 105 }; |
106 | 106 |
107 public: | 107 public: |
108 /** | 108 /** |
109 * Gets a path ref with no verbs or points. | 109 * Gets a path ref with no verbs or points. |
110 */ | 110 */ |
111 static SkPathRef* CreateEmpty() { | 111 static SkPathRef* CreateEmpty() { |
112 static SkPathRef* gEmptyPathRef; | 112 static SkPathRef* gEmptyPathRef; |
113 if (!gEmptyPathRef) { | 113 if (!gEmptyPathRef) { |
114 gEmptyPathRef = SkNEW(SkPathRef); // leak! | 114 gEmptyPathRef = SkNEW(SkPathRef); // leak! |
| 115 gEmptyPathRef->computeBounds(); // Premptively avoid a race to cle
ar fBoundsIsDirty. |
115 } | 116 } |
116 return SkRef(gEmptyPathRef); | 117 return SkRef(gEmptyPathRef); |
117 } | 118 } |
118 | 119 |
119 /** | 120 /** |
120 * Returns true if all of the points in this path are finite, meaning there | 121 * Returns true if all of the points in this path are finite, meaning there |
121 * are no infinities and no NaNs. | 122 * are no infinities and no NaNs. |
122 */ | 123 */ |
123 bool isFinite() const { | 124 bool isFinite() const { |
124 if (fBoundsIsDirty) { | 125 if (fBoundsIsDirty) { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 enum { | 357 enum { |
357 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer
o verbs. | 358 kEmptyGenID = 1, // GenID reserved for path ref with zero points and zer
o verbs. |
358 }; | 359 }; |
359 mutable int32_t fGenerationID; | 360 mutable int32_t fGenerationID; |
360 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use
at any time. | 361 SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use
at any time. |
361 | 362 |
362 typedef SkRefCnt INHERITED; | 363 typedef SkRefCnt INHERITED; |
363 }; | 364 }; |
364 | 365 |
365 #endif | 366 #endif |
OLD | NEW |