Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: src/core/SkPathEffect.cpp

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/core/SkPictureShader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/core/SkPictureShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698