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

Side by Side Diff: gm/perlinnoise.cpp

Issue 14087002: Perlin noise adjustments (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « bench/PerlinNoiseBench.cpp ('k') | gyp/bench.gypi » ('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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 #include "gm.h" 8 #include "gm.h"
9 #include "SkPerlinNoiseShader.h" 9 #include "SkPerlinNoiseShader.h"
10 10
(...skipping 21 matching lines...) Expand all
32 SkIntToScalar(fSize.width()), SkIntToScalar(fSize.heigh t()))); 32 SkIntToScalar(fSize.width()), SkIntToScalar(fSize.heigh t())));
33 SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y), 33 SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y),
34 SkIntToScalar(fSize.width()), 34 SkIntToScalar(fSize.width()),
35 SkIntToScalar(fSize.height())); 35 SkIntToScalar(fSize.height()));
36 canvas->drawRect(r, paint); 36 canvas->drawRect(r, paint);
37 canvas->restore(); 37 canvas->restore();
38 } 38 }
39 39
40 void test(SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Type type, 40 void test(SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Type type,
41 float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, 41 float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed,
42 bool stitchTiles) 42 bool stitchTiles) {
43 {
44 SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? 43 SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ?
45 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequenc yY, numOctaves, 44 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequenc yY, numOctaves,
46 seed, stitchTiles ? &fSize : NULL) : 45 seed, stitchTiles ? &fSize : NULL) :
47 SkPerlinNoiseShader::CreateTubulence(baseFrequencyX, baseFrequencyY, numOctaves, 46 SkPerlinNoiseShader::CreateTubulence(baseFrequencyX, baseFrequencyY, numOctaves,
48 seed, stitchTiles ? &fSize : NUL L); 47 seed, stitchTiles ? &fSize : NUL L);
49 SkPaint paint; 48 SkPaint paint;
50 paint.setShader(shader)->unref(); 49 paint.setShader(shader)->unref();
51 drawClippedRect(canvas, x, y, paint); 50 drawClippedRect(canvas, x, y, paint);
52 } 51 }
53 52
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 typedef GM INHERITED; 104 typedef GM INHERITED;
106 SkISize fSize; 105 SkISize fSize;
107 }; 106 };
108 107
109 ////////////////////////////////////////////////////////////////////////////// 108 //////////////////////////////////////////////////////////////////////////////
110 109
111 static GM* MyFactory(void*) { return new PerlinNoiseGM; } 110 static GM* MyFactory(void*) { return new PerlinNoiseGM; }
112 static GMRegistry reg(MyFactory); 111 static GMRegistry reg(MyFactory);
113 112
114 } 113 }
OLDNEW
« no previous file with comments | « bench/PerlinNoiseBench.cpp ('k') | gyp/bench.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698