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

Side by Side Diff: samplecode/SampleAnimBlur.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 | « include/utils/SkRandom.h ('k') | samplecode/SampleApp.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 2012 Google Inc. 3 * Copyright 2012 Google Inc.
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 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 25 matching lines...) Expand all
36 SampleCode::GetAnimSinScalar(150 * SK_Scalar1, 36 SampleCode::GetAnimSinScalar(150 * SK_Scalar1,
37 25 * SK_Scalar1, 37 25 * SK_Scalar1,
38 3 * SK_Scalar1); 38 3 * SK_Scalar1);
39 39
40 static const SkBlurMaskFilter::BlurStyle gStyles[] = { 40 static const SkBlurMaskFilter::BlurStyle gStyles[] = {
41 SkBlurMaskFilter::kNormal_BlurStyle, 41 SkBlurMaskFilter::kNormal_BlurStyle,
42 SkBlurMaskFilter::kInner_BlurStyle, 42 SkBlurMaskFilter::kInner_BlurStyle,
43 SkBlurMaskFilter::kSolid_BlurStyle, 43 SkBlurMaskFilter::kSolid_BlurStyle,
44 SkBlurMaskFilter::kOuter_BlurStyle, 44 SkBlurMaskFilter::kOuter_BlurStyle,
45 }; 45 };
46 SkMWCRandom random; 46 SkRandom random;
47 47
48 for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) { 48 for (size_t i = 0; i < SK_ARRAY_COUNT(gStyles); ++i) {
49 SkMaskFilter* mf = SkBlurMaskFilter::Create( 49 SkMaskFilter* mf = SkBlurMaskFilter::Create(
50 gStyles[i], 50 gStyles[i],
51 blurSigma, 51 blurSigma,
52 SkBlurMaskFilter::kHighQuality_BlurFlag); 52 SkBlurMaskFilter::kHighQuality_BlurFlag);
53 SkPaint paint; 53 SkPaint paint;
54 SkSafeUnref(paint.setMaskFilter(mf)); 54 SkSafeUnref(paint.setMaskFilter(mf));
55 paint.setColor(random.nextU() | 0xff000000); 55 paint.setColor(random.nextU() | 0xff000000);
56 canvas->drawCircle(200 * SK_Scalar1 + 400 * (i % 2) * SK_Scalar1, 56 canvas->drawCircle(200 * SK_Scalar1 + 400 * (i % 2) * SK_Scalar1,
57 200 * SK_Scalar1 + i / 2 * 400 * SK_Scalar1, 57 200 * SK_Scalar1 + i / 2 * 400 * SK_Scalar1,
58 circleRadius, paint); 58 circleRadius, paint);
59 } 59 }
60 this->inval(NULL); 60 this->inval(NULL);
61 } 61 }
62 62
63 private: 63 private:
64 typedef SkView INHERITED; 64 typedef SkView INHERITED;
65 }; 65 };
66 66
67 ////////////////////////////////////////////////////////////////////////////// 67 //////////////////////////////////////////////////////////////////////////////
68 68
69 static SkView* MyFactory() { return new AnimBlurView; } 69 static SkView* MyFactory() { return new AnimBlurView; }
70 static SkViewRegister reg(MyFactory); 70 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/utils/SkRandom.h ('k') | samplecode/SampleApp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698