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

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

Issue 23576015: Change old PRG to be SkLCGRandom; change new one to SkRandom (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix some spurious SkMWCRandoms Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.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"
(...skipping 13 matching lines...) Expand all
24 : fSegLength(segLength), fPerterb(deviation) 24 : fSegLength(segLength), fPerterb(deviation)
25 { 25 {
26 } 26 }
27 27
28 bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src, 28 bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src,
29 SkStrokeRec* rec, const SkRect*) const { 29 SkStrokeRec* rec, const SkRect*) const {
30 bool doFill = rec->isFillStyle(); 30 bool doFill = rec->isFillStyle();
31 31
32 SkPathMeasure meas(src, doFill); 32 SkPathMeasure meas(src, doFill);
33 uint32_t seed = SkScalarRound(meas.getLength()); 33 uint32_t seed = SkScalarRound(meas.getLength());
34 SkRandom rand(seed ^ ((seed << 16) | (seed >> 16))); 34 SkLCGRandom rand(seed ^ ((seed << 16) | (seed >> 16)));
35 SkScalar scale = fPerterb; 35 SkScalar scale = fPerterb;
36 SkPoint p; 36 SkPoint p;
37 SkVector v; 37 SkVector v;
38 38
39 do { 39 do {
40 SkScalar length = meas.getLength(); 40 SkScalar length = meas.getLength();
41 41
42 if (fSegLength * (2 + doFill) > length) { 42 if (fSegLength * (2 + doFill) > length) {
43 meas.getSegment(0, length, dst, true); // to short for us to mangle 43 meas.getSegment(0, length, dst, true); // to short for us to mangle
44 } else { 44 } else {
(...skipping 28 matching lines...) Expand all
73 void SkDiscretePathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { 73 void SkDiscretePathEffect::flatten(SkFlattenableWriteBuffer& buffer) const {
74 this->INHERITED::flatten(buffer); 74 this->INHERITED::flatten(buffer);
75 buffer.writeScalar(fSegLength); 75 buffer.writeScalar(fSegLength);
76 buffer.writeScalar(fPerterb); 76 buffer.writeScalar(fPerterb);
77 } 77 }
78 78
79 SkDiscretePathEffect::SkDiscretePathEffect(SkFlattenableReadBuffer& buffer) { 79 SkDiscretePathEffect::SkDiscretePathEffect(SkFlattenableReadBuffer& buffer) {
80 fSegLength = buffer.readScalar(); 80 fSegLength = buffer.readScalar();
81 fPerterb = buffer.readScalar(); 81 fPerterb = buffer.readScalar();
82 } 82 }
OLDNEW
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698