| 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 #include "SkPathEffect.h" | 9 #include "SkPathEffect.h" |
| 10 #include "SkPath.h" | 10 #include "SkPath.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 fPE1->toString(str); | 60 fPE1->toString(str); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 /////////////////////////////////////////////////////////////////////////////// | 65 /////////////////////////////////////////////////////////////////////////////// |
| 66 | 66 |
| 67 SkFlattenable* SkComposePathEffect::CreateProc(SkReadBuffer& buffer) { | 67 SkFlattenable* SkComposePathEffect::CreateProc(SkReadBuffer& buffer) { |
| 68 SkAutoTUnref<SkPathEffect> pe0(buffer.readPathEffect()); | 68 SkAutoTUnref<SkPathEffect> pe0(buffer.readPathEffect()); |
| 69 SkAutoTUnref<SkPathEffect> pe1(buffer.readPathEffect()); | 69 SkAutoTUnref<SkPathEffect> pe1(buffer.readPathEffect()); |
| 70 return SkComposePathEffect::Create(pe0, pe1); | 70 if (pe0 && pe1) { |
| 71 return SkComposePathEffect::Create(pe0, pe1); |
| 72 } else { |
| 73 return nullptr; |
| 74 } |
| 71 } | 75 } |
| 72 | 76 |
| 73 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src, | 77 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src, |
| 74 SkStrokeRec* rec, const SkRect* cullRect) const { | 78 SkStrokeRec* rec, const SkRect* cullRect) const { |
| 75 // we may have failed to unflatten these, so we have to check | 79 // we may have failed to unflatten these, so we have to check |
| 76 if (!fPE0 || !fPE1) { | 80 if (!fPE0 || !fPE1) { |
| 77 return false; | 81 return false; |
| 78 } | 82 } |
| 79 | 83 |
| 80 SkPath tmp; | 84 SkPath tmp; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 93 this->INHERITED::toString(str); | 97 this->INHERITED::toString(str); |
| 94 str->appendf(")"); | 98 str->appendf(")"); |
| 95 } | 99 } |
| 96 #endif | 100 #endif |
| 97 | 101 |
| 98 /////////////////////////////////////////////////////////////////////////////// | 102 /////////////////////////////////////////////////////////////////////////////// |
| 99 | 103 |
| 100 SkFlattenable* SkSumPathEffect::CreateProc(SkReadBuffer& buffer) { | 104 SkFlattenable* SkSumPathEffect::CreateProc(SkReadBuffer& buffer) { |
| 101 SkAutoTUnref<SkPathEffect> pe0(buffer.readPathEffect()); | 105 SkAutoTUnref<SkPathEffect> pe0(buffer.readPathEffect()); |
| 102 SkAutoTUnref<SkPathEffect> pe1(buffer.readPathEffect()); | 106 SkAutoTUnref<SkPathEffect> pe1(buffer.readPathEffect()); |
| 103 return SkSumPathEffect::Create(pe0, pe1); | 107 if (pe0 && pe1) { |
| 108 return SkSumPathEffect::Create(pe0, pe1); |
| 109 } else { |
| 110 return nullptr; |
| 111 } |
| 104 } | 112 } |
| 105 | 113 |
| 106 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src, | 114 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src, |
| 107 SkStrokeRec* rec, const SkRect* cullRect) const { | 115 SkStrokeRec* rec, const SkRect* cullRect) const { |
| 108 // use bit-or so that we always call both, even if the first one succeeds | 116 // use bit-or so that we always call both, even if the first one succeeds |
| 109 return fPE0->filterPath(dst, src, rec, cullRect) | | 117 return fPE0->filterPath(dst, src, rec, cullRect) | |
| 110 fPE1->filterPath(dst, src, rec, cullRect); | 118 fPE1->filterPath(dst, src, rec, cullRect); |
| 111 } | 119 } |
| 112 | 120 |
| 113 | 121 |
| 114 #ifndef SK_IGNORE_TO_STRING | 122 #ifndef SK_IGNORE_TO_STRING |
| 115 void SkSumPathEffect::toString(SkString* str) const { | 123 void SkSumPathEffect::toString(SkString* str) const { |
| 116 str->appendf("SkSumPathEffect: ("); | 124 str->appendf("SkSumPathEffect: ("); |
| 117 this->INHERITED::toString(str); | 125 this->INHERITED::toString(str); |
| 118 str->appendf(")"); | 126 str->appendf(")"); |
| 119 } | 127 } |
| 120 #endif | 128 #endif |
| OLD | NEW |