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

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

Issue 1813553005: switch patheffects over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: try to fix xpsdevice 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
16 static void Perterb(SkPoint* p, const SkVector& tangent, SkScalar scale) { 21 static void Perterb(SkPoint* p, const SkVector& tangent, SkScalar scale) {
17 SkVector normal = tangent; 22 SkVector normal = tangent;
18 normal.rotateCCW(); 23 normal.rotateCCW();
19 normal.setLength(scale); 24 normal.setLength(scale);
20 *p += normal; 25 *p += normal;
21 } 26 }
22 27
23 SkDiscretePathEffect::SkDiscretePathEffect(SkScalar segLength, 28 SkDiscretePathEffect::SkDiscretePathEffect(SkScalar segLength,
24 SkScalar deviation, 29 SkScalar deviation,
25 uint32_t seedAssist) 30 uint32_t seedAssist)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 119 }
115 } 120 }
116 } while (meas.nextContour()); 121 } while (meas.nextContour());
117 return true; 122 return true;
118 } 123 }
119 124
120 SkFlattenable* SkDiscretePathEffect::CreateProc(SkReadBuffer& buffer) { 125 SkFlattenable* SkDiscretePathEffect::CreateProc(SkReadBuffer& buffer) {
121 SkScalar segLength = buffer.readScalar(); 126 SkScalar segLength = buffer.readScalar();
122 SkScalar perterb = buffer.readScalar(); 127 SkScalar perterb = buffer.readScalar();
123 uint32_t seed = buffer.readUInt(); 128 uint32_t seed = buffer.readUInt();
124 return Create(segLength, perterb, seed); 129 return Make(segLength, perterb, seed).release();
125 } 130 }
126 131
127 void SkDiscretePathEffect::flatten(SkWriteBuffer& buffer) const { 132 void SkDiscretePathEffect::flatten(SkWriteBuffer& buffer) const {
128 buffer.writeScalar(fSegLength); 133 buffer.writeScalar(fSegLength);
129 buffer.writeScalar(fPerterb); 134 buffer.writeScalar(fPerterb);
130 buffer.writeUInt(fSeedAssist); 135 buffer.writeUInt(fSeedAssist);
131 } 136 }
132 137
133 #ifndef SK_IGNORE_TO_STRING 138 #ifndef SK_IGNORE_TO_STRING
134 void SkDiscretePathEffect::toString(SkString* str) const { 139 void SkDiscretePathEffect::toString(SkString* str) const {
135 str->appendf("SkDiscretePathEffect: ("); 140 str->appendf("SkDiscretePathEffect: (");
136 str->appendf("segLength: %.2f deviation: %.2f seed %d", fSegLength, fPerterb , fSeedAssist); 141 str->appendf("segLength: %.2f deviation: %.2f seed %d", fSegLength, fPerterb , fSeedAssist);
137 str->append(")"); 142 str->append(")");
138 } 143 }
139 #endif 144 #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