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

Side by Side Diff: gm/perlinnoise.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 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
« no previous file with comments | « gm/peekpixels.cpp ('k') | gm/picture.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 * 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 canvas->drawRect(r, paint); 32 canvas->drawRect(r, paint);
33 canvas->restore(); 33 canvas->restore();
34 } 34 }
35 35
36 void test(SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Type type, 36 void test(SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Type type,
37 float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, 37 float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed,
38 bool stitchTiles) { 38 bool stitchTiles) {
39 SkISize tileSize = SkISize::Make(fSize.width() / 2, fSize.height() / 2); 39 SkISize tileSize = SkISize::Make(fSize.width() / 2, fSize.height() / 2);
40 SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? 40 SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ?
41 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequenc yY, numOctaves, 41 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequenc yY, numOctaves,
42 seed, stitchTiles ? &tileSize : NULL) : 42 seed, stitchTiles ? &tileSize : nullptr) :
43 SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY , numOctaves, 43 SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY , numOctaves,
44 seed, stitchTiles ? &tileSize : NULL); 44 seed, stitchTiles ? &tileSize : nullptr);
45 SkPaint paint; 45 SkPaint paint;
46 paint.setShader(shader)->unref(); 46 paint.setShader(shader)->unref();
47 if (stitchTiles) { 47 if (stitchTiles) {
48 drawRect(canvas, x, y, paint, tileSize); 48 drawRect(canvas, x, y, paint, tileSize);
49 x += tileSize.width(); 49 x += tileSize.width();
50 drawRect(canvas, x, y, paint, tileSize); 50 drawRect(canvas, x, y, paint, tileSize);
51 y += tileSize.width(); 51 y += tileSize.width();
52 drawRect(canvas, x, y, paint, tileSize); 52 drawRect(canvas, x, y, paint, tileSize);
53 x -= tileSize.width(); 53 x -= tileSize.width();
54 drawRect(canvas, x, y, paint, tileSize); 54 drawRect(canvas, x, y, paint, tileSize);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 virtual SkISize onISize() { 106 virtual SkISize onISize() {
107 return SkISize::Make(640, 480); 107 return SkISize::Make(640, 480);
108 } 108 }
109 109
110 void install(SkPaint* paint, SkPerlinNoiseShader::Type type, 110 void install(SkPaint* paint, SkPerlinNoiseShader::Type type,
111 float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, 111 float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed,
112 bool stitchTiles) { 112 bool stitchTiles) {
113 SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? 113 SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ?
114 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, 114 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves,
115 seed, stitchTiles ? &fSize : NUL L) : 115 seed, stitchTiles ? &fSize : nul lptr) :
116 SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, nu mOctaves, 116 SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, nu mOctaves,
117 seed, stitchTiles ? &fSize : NULL) ; 117 seed, stitchTiles ? &fSize : nullp tr);
118 paint->setShader(shader)->unref(); 118 paint->setShader(shader)->unref();
119 } 119 }
120 120
121 virtual void onDraw(SkCanvas* canvas) { 121 virtual void onDraw(SkCanvas* canvas) {
122 canvas->translate(10, 10); 122 canvas->translate(10, 10);
123 123
124 SkPaint paint; 124 SkPaint paint;
125 install(&paint, SkPerlinNoiseShader::kFractalNoise_Type, 0.1f, 0.1f, 2, 0, false); 125 install(&paint, SkPerlinNoiseShader::kFractalNoise_Type, 0.1f, 0.1f, 2, 0, false);
126 126
127 const SkScalar w = SkIntToScalar(fSize.width()); 127 const SkScalar w = SkIntToScalar(fSize.width());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 private: 172 private:
173 typedef GM INHERITED; 173 typedef GM INHERITED;
174 SkISize fSize; 174 SkISize fSize;
175 }; 175 };
176 176
177 ////////////////////////////////////////////////////////////////////////////// 177 //////////////////////////////////////////////////////////////////////////////
178 178
179 DEF_GM( return new PerlinNoiseGM; ) 179 DEF_GM( return new PerlinNoiseGM; )
180 DEF_GM( return new PerlinNoiseGM2; ) 180 DEF_GM( return new PerlinNoiseGM2; )
OLDNEW
« no previous file with comments | « gm/peekpixels.cpp ('k') | gm/picture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698