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

Side by Side Diff: bench/PerlinNoiseBench.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 Created 4 years, 9 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 | « bench/PDFBench.cpp ('k') | bench/ShaderMaskBench.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 #include "Benchmark.h" 7 #include "Benchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPerlinNoiseShader.h" 9 #include "SkPerlinNoiseShader.h"
10 10
(...skipping 23 matching lines...) Expand all
34 SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y), 34 SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y),
35 SkIntToScalar(fSize.width()), 35 SkIntToScalar(fSize.width()),
36 SkIntToScalar(fSize.height())); 36 SkIntToScalar(fSize.height()));
37 canvas->drawRect(r, paint); 37 canvas->drawRect(r, paint);
38 canvas->restore(); 38 canvas->restore();
39 } 39 }
40 40
41 void test(int loops, SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Ty pe type, 41 void test(int loops, SkCanvas* canvas, int x, int y, SkPerlinNoiseShader::Ty pe type,
42 float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, 42 float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed,
43 bool stitchTiles) { 43 bool stitchTiles) {
44 SkShader* shader = (type == SkPerlinNoiseShader::kFractalNoise_Type) ? 44 sk_sp<SkShader> shader = (type == SkPerlinNoiseShader::kFractalNoise_Typ e) ?
45 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequenc yY, numOctaves, 45 SkPerlinNoiseShader::MakeFractalNoise(baseFrequencyX, baseFrequencyY , numOctaves,
46 seed, stitchTiles ? &fSize : nullptr) : 46 seed, stitchTiles ? &fSize : n ullptr) :
47 SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY , numOctaves, 47 SkPerlinNoiseShader::MakeTurbulence(baseFrequencyX, baseFrequencyY, numOctaves,
48 seed, stitchTiles ? &fSize : nu llptr); 48 seed, stitchTiles ? &fSize : nul lptr);
49 SkPaint paint; 49 SkPaint paint;
50 paint.setShader(shader)->unref(); 50 paint.setShader(shader);
51 51
52 for (int i = 0; i < loops; i++) { 52 for (int i = 0; i < loops; i++) {
53 this->drawClippedRect(canvas, x, y, paint); 53 this->drawClippedRect(canvas, x, y, paint);
54 } 54 }
55 } 55 }
56 56
57 typedef Benchmark INHERITED; 57 typedef Benchmark INHERITED;
58 }; 58 };
59 59
60 /////////////////////////////////////////////////////////////////////////////// 60 ///////////////////////////////////////////////////////////////////////////////
61 61
62 DEF_BENCH( return new PerlinNoiseBench(); ) 62 DEF_BENCH( return new PerlinNoiseBench(); )
OLDNEW
« no previous file with comments | « bench/PDFBench.cpp ('k') | bench/ShaderMaskBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698