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 "SkPathEffect.h" | 8 #include "SkPathEffect.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 str->appendf(" second: "); | 51 str->appendf(" second: "); |
52 if (fPE1) { | 52 if (fPE1) { |
53 fPE1->toString(str); | 53 fPE1->toString(str); |
54 } | 54 } |
55 } | 55 } |
56 #endif | 56 #endif |
57 | 57 |
58 /////////////////////////////////////////////////////////////////////////////// | 58 /////////////////////////////////////////////////////////////////////////////// |
59 | 59 |
60 SkFlattenable* SkComposePathEffect::CreateProc(SkReadBuffer& buffer) { | 60 sk_sp<SkFlattenable> SkComposePathEffect::CreateProc(SkReadBuffer& buffer) { |
61 sk_sp<SkPathEffect> pe0(buffer.readPathEffect()); | 61 sk_sp<SkPathEffect> pe0(buffer.readPathEffect()); |
62 sk_sp<SkPathEffect> pe1(buffer.readPathEffect()); | 62 sk_sp<SkPathEffect> pe1(buffer.readPathEffect()); |
63 return SkComposePathEffect::Make(std::move(pe0), std::move(pe1)).release(); | 63 return SkComposePathEffect::Make(std::move(pe0), std::move(pe1)); |
64 } | 64 } |
65 | 65 |
66 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src, | 66 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src, |
67 SkStrokeRec* rec, const SkRect* cullRect) const { | 67 SkStrokeRec* rec, const SkRect* cullRect) const { |
68 SkPath tmp; | 68 SkPath tmp; |
69 const SkPath* ptr = &src; | 69 const SkPath* ptr = &src; |
70 | 70 |
71 if (fPE1->filterPath(&tmp, src, rec, cullRect)) { | 71 if (fPE1->filterPath(&tmp, src, rec, cullRect)) { |
72 ptr = &tmp; | 72 ptr = &tmp; |
73 } | 73 } |
74 return fPE0->filterPath(dst, *ptr, rec, cullRect); | 74 return fPE0->filterPath(dst, *ptr, rec, cullRect); |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 #ifndef SK_IGNORE_TO_STRING | 78 #ifndef SK_IGNORE_TO_STRING |
79 void SkComposePathEffect::toString(SkString* str) const { | 79 void SkComposePathEffect::toString(SkString* str) const { |
80 str->appendf("SkComposePathEffect: ("); | 80 str->appendf("SkComposePathEffect: ("); |
81 this->INHERITED::toString(str); | 81 this->INHERITED::toString(str); |
82 str->appendf(")"); | 82 str->appendf(")"); |
83 } | 83 } |
84 #endif | 84 #endif |
85 | 85 |
86 /////////////////////////////////////////////////////////////////////////////// | 86 /////////////////////////////////////////////////////////////////////////////// |
87 | 87 |
88 SkFlattenable* SkSumPathEffect::CreateProc(SkReadBuffer& buffer) { | 88 sk_sp<SkFlattenable> SkSumPathEffect::CreateProc(SkReadBuffer& buffer) { |
89 sk_sp<SkPathEffect> pe0(buffer.readPathEffect()); | 89 sk_sp<SkPathEffect> pe0(buffer.readPathEffect()); |
90 sk_sp<SkPathEffect> pe1(buffer.readPathEffect()); | 90 sk_sp<SkPathEffect> pe1(buffer.readPathEffect()); |
91 return SkSumPathEffect::Make(pe0, pe1).release(); | 91 return SkSumPathEffect::Make(pe0, pe1); |
92 } | 92 } |
93 | 93 |
94 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src, | 94 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src, |
95 SkStrokeRec* rec, const SkRect* cullRect) const { | 95 SkStrokeRec* rec, const SkRect* cullRect) const { |
96 // use bit-or so that we always call both, even if the first one succeeds | 96 // use bit-or so that we always call both, even if the first one succeeds |
97 return fPE0->filterPath(dst, src, rec, cullRect) | | 97 return fPE0->filterPath(dst, src, rec, cullRect) | |
98 fPE1->filterPath(dst, src, rec, cullRect); | 98 fPE1->filterPath(dst, src, rec, cullRect); |
99 } | 99 } |
100 | 100 |
101 | 101 |
102 #ifndef SK_IGNORE_TO_STRING | 102 #ifndef SK_IGNORE_TO_STRING |
103 void SkSumPathEffect::toString(SkString* str) const { | 103 void SkSumPathEffect::toString(SkString* str) const { |
104 str->appendf("SkSumPathEffect: ("); | 104 str->appendf("SkSumPathEffect: ("); |
105 this->INHERITED::toString(str); | 105 this->INHERITED::toString(str); |
106 str->appendf(")"); | 106 str->appendf(")"); |
107 } | 107 } |
108 #endif | 108 #endif |
OLD | NEW |