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

Side by Side Diff: include/effects/SkDiscretePathEffect.h

Issue 311803002: Randomize seed for SkDiscretePathEffect::filterPath() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unnecessary function Created 6 years, 6 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 * 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 #ifndef SkDiscretePathEffect_DEFINED 8 #ifndef SkDiscretePathEffect_DEFINED
9 #define SkDiscretePathEffect_DEFINED 9 #define SkDiscretePathEffect_DEFINED
10 10
11 #include "SkPathEffect.h" 11 #include "SkPathEffect.h"
12 #include "SkRandom.h"
scroggo 2014/06/05 16:09:30 No need for this include here, since the header do
rs.prinja 2014/06/07 10:46:05 Done.
12 13
13 /** \class SkDiscretePathEffect 14 /** \class SkDiscretePathEffect
14 15
15 This path effect chops a path into discrete segments, and randomly displaces them. 16 This path effect chops a path into discrete segments, and randomly displaces them.
16 */ 17 */
17 class SK_API SkDiscretePathEffect : public SkPathEffect { 18 class SK_API SkDiscretePathEffect : public SkPathEffect {
18 public: 19 public:
19 /** Break the path into segments of segLength length, and randomly move the endpoints 20 /** Break the path into segments of segLength length, and randomly move the endpoints
20 away from the original path by a maximum of deviation. 21 away from the original path by a maximum of deviation.
21 Note: works on filled or framed paths 22 Note: works on filled or framed paths
22 */ 23 */
23 static SkDiscretePathEffect* Create(SkScalar segLength, SkScalar deviation) { 24 static SkDiscretePathEffect* Create(SkScalar segLength, SkScalar deviation, uint32_t seedAssist=1) {
scroggo 2014/06/05 16:09:30 Please use a line break so the line is not over 10
rs.prinja 2014/06/07 10:46:04 Done.
24 return SkNEW_ARGS(SkDiscretePathEffect, (segLength, deviation)); 25 return SkNEW_ARGS(SkDiscretePathEffect, (segLength, deviation, seedAssis t));
25 } 26 }
26 27
27 virtual bool filterPath(SkPath* dst, const SkPath& src, 28 virtual bool filterPath(SkPath* dst, const SkPath& src,
28 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; 29 SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
29 30
30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect) 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)
31 32
32 protected: 33 protected:
33 SkDiscretePathEffect(SkScalar segLength, SkScalar deviation); 34 SkDiscretePathEffect(SkScalar segLength, SkScalar deviation, uint32_t seedAs sist=1);
scroggo 2014/06/05 16:09:30 In general, we only want a default parameter on th
rs.prinja 2014/06/07 10:46:05 Done.
34 explicit SkDiscretePathEffect(SkReadBuffer&); 35 explicit SkDiscretePathEffect(SkReadBuffer&);
35 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 36 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
36 37
37 private: 38 private:
38 SkScalar fSegLength, fPerterb; 39 SkScalar fSegLength, fPerterb;
39 40
41 /* Caller-supplied 32 bit seed assist */
42 uint32_t fSeedAssist;
43
44 static uint32_t fObjectIdGenerator;
scroggo 2014/06/05 16:09:30 This is not needed. As discussed in skbug.com/2581
rs.prinja 2014/06/07 10:46:04 Done.
45 uint32_t fObjectId;
scroggo 2014/06/05 16:09:30 Please remove.
rs.prinja 2014/06/07 10:46:04 Done.
46
40 typedef SkPathEffect INHERITED; 47 typedef SkPathEffect INHERITED;
41 }; 48 };
42 49
43 #endif 50 #endif
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkDiscretePathEffect.cpp » ('j') | src/effects/SkDiscretePathEffect.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698