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

Side by Side Diff: src/effects/SkDiscretePathEffect.cpp

Issue 1817543002: Revert of switch patheffects over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/effects/SkDashPathEffect.cpp ('k') | src/effects/SkLayerDrawLooper.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 /* 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 9
10 #include "SkDiscretePathEffect.h" 10 #include "SkDiscretePathEffect.h"
11 #include "SkReadBuffer.h" 11 #include "SkReadBuffer.h"
12 #include "SkWriteBuffer.h" 12 #include "SkWriteBuffer.h"
13 #include "SkPathMeasure.h" 13 #include "SkPathMeasure.h"
14 #include "SkStrokeRec.h" 14 #include "SkStrokeRec.h"
15 15
16 sk_sp<SkPathEffect> SkDiscretePathEffect::Make(SkScalar segLength, SkScalar devi ation,
17 uint32_t seedAssist) {
18 return sk_sp<SkPathEffect>(new SkDiscretePathEffect(segLength, deviation, se edAssist));
19 }
20
21 static void Perterb(SkPoint* p, const SkVector& tangent, SkScalar scale) { 16 static void Perterb(SkPoint* p, const SkVector& tangent, SkScalar scale) {
22 SkVector normal = tangent; 17 SkVector normal = tangent;
23 normal.rotateCCW(); 18 normal.rotateCCW();
24 normal.setLength(scale); 19 normal.setLength(scale);
25 *p += normal; 20 *p += normal;
26 } 21 }
27 22
28 SkDiscretePathEffect::SkDiscretePathEffect(SkScalar segLength, 23 SkDiscretePathEffect::SkDiscretePathEffect(SkScalar segLength,
29 SkScalar deviation, 24 SkScalar deviation,
30 uint32_t seedAssist) 25 uint32_t seedAssist)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 114 }
120 } 115 }
121 } while (meas.nextContour()); 116 } while (meas.nextContour());
122 return true; 117 return true;
123 } 118 }
124 119
125 SkFlattenable* SkDiscretePathEffect::CreateProc(SkReadBuffer& buffer) { 120 SkFlattenable* SkDiscretePathEffect::CreateProc(SkReadBuffer& buffer) {
126 SkScalar segLength = buffer.readScalar(); 121 SkScalar segLength = buffer.readScalar();
127 SkScalar perterb = buffer.readScalar(); 122 SkScalar perterb = buffer.readScalar();
128 uint32_t seed = buffer.readUInt(); 123 uint32_t seed = buffer.readUInt();
129 return Make(segLength, perterb, seed).release(); 124 return Create(segLength, perterb, seed);
130 } 125 }
131 126
132 void SkDiscretePathEffect::flatten(SkWriteBuffer& buffer) const { 127 void SkDiscretePathEffect::flatten(SkWriteBuffer& buffer) const {
133 buffer.writeScalar(fSegLength); 128 buffer.writeScalar(fSegLength);
134 buffer.writeScalar(fPerterb); 129 buffer.writeScalar(fPerterb);
135 buffer.writeUInt(fSeedAssist); 130 buffer.writeUInt(fSeedAssist);
136 } 131 }
137 132
138 #ifndef SK_IGNORE_TO_STRING 133 #ifndef SK_IGNORE_TO_STRING
139 void SkDiscretePathEffect::toString(SkString* str) const { 134 void SkDiscretePathEffect::toString(SkString* str) const {
140 str->appendf("SkDiscretePathEffect: ("); 135 str->appendf("SkDiscretePathEffect: (");
141 str->appendf("segLength: %.2f deviation: %.2f seed %d", fSegLength, fPerterb , fSeedAssist); 136 str->appendf("segLength: %.2f deviation: %.2f seed %d", fSegLength, fPerterb , fSeedAssist);
142 str->append(")"); 137 str->append(")");
143 } 138 }
144 #endif 139 #endif
OLDNEW
« no previous file with comments | « src/effects/SkDashPathEffect.cpp ('k') | src/effects/SkLayerDrawLooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698