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

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

Issue 1556553002: Implement an SkPaint-based image filter (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: More randomness for paths and for rasterizer's paint Created 4 years, 11 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698