OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 "SkLazyPtr.h" | 9 #include "SkLazyPtr.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 copy->copy(**pathRef, incReserveVerbs, incReservePoints); | 22 copy->copy(**pathRef, incReserveVerbs, incReservePoints); |
23 pathRef->reset(copy); | 23 pathRef->reset(copy); |
24 } | 24 } |
25 fPathRef = *pathRef; | 25 fPathRef = *pathRef; |
26 fPathRef->fGenerationID = 0; | 26 fPathRef->fGenerationID = 0; |
27 SkDEBUGCODE(sk_atomic_inc(&fPathRef->fEditorsAttached);) | 27 SkDEBUGCODE(sk_atomic_inc(&fPathRef->fEditorsAttached);) |
28 } | 28 } |
29 | 29 |
30 ////////////////////////////////////////////////////////////////////////////// | 30 ////////////////////////////////////////////////////////////////////////////// |
31 | 31 |
32 SkPathRef* SkPathRef::CreateEmptyImpl() { | 32 // As a template argument, this must have external linkage. |
| 33 SkPathRef* sk_create_empty_pathref() { |
33 SkPathRef* empty = SkNEW(SkPathRef); | 34 SkPathRef* empty = SkNEW(SkPathRef); |
34 empty->computeBounds(); // Avoids races later to be the first to do this. | 35 empty->computeBounds(); // Avoids races later to be the first to do this. |
35 return empty; | 36 return empty; |
36 } | 37 } |
37 | 38 |
| 39 SK_DECLARE_STATIC_LAZY_PTR(SkPathRef, empty, sk_create_empty_pathref); |
| 40 |
38 SkPathRef* SkPathRef::CreateEmpty() { | 41 SkPathRef* SkPathRef::CreateEmpty() { |
39 SK_DECLARE_STATIC_LAZY_PTR(SkPathRef, empty, CreateEmptyImpl); | |
40 return SkRef(empty.get()); | 42 return SkRef(empty.get()); |
41 } | 43 } |
42 | 44 |
43 void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst, | 45 void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst, |
44 const SkPathRef& src, | 46 const SkPathRef& src, |
45 const SkMatrix& matrix) { | 47 const SkMatrix& matrix) { |
46 SkDEBUGCODE(src.validate();) | 48 SkDEBUGCODE(src.validate();) |
47 if (matrix.isIdentity()) { | 49 if (matrix.isIdentity()) { |
48 if (*dst != &src) { | 50 if (*dst != &src) { |
49 src.ref(); | 51 src.ref(); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 break; | 483 break; |
482 default: | 484 default: |
483 SkDEBUGFAIL("Unknown Verb"); | 485 SkDEBUGFAIL("Unknown Verb"); |
484 break; | 486 break; |
485 } | 487 } |
486 } | 488 } |
487 SkASSERT(mask == fSegmentMask); | 489 SkASSERT(mask == fSegmentMask); |
488 #endif // SK_DEBUG_PATH | 490 #endif // SK_DEBUG_PATH |
489 } | 491 } |
490 #endif | 492 #endif |
OLD | NEW |