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

Side by Side Diff: tools/VisualBench/VisualBenchmarkStream.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 | « tests/ImageFilterTest.cpp ('k') | tools/debugger/SkDrawCommand.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 2015 Google Inc. 2 * Copyright 2015 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 8
9 #include <VisualBench/VisualBenchmarkStream.h> 9 #include <VisualBench/VisualBenchmarkStream.h>
10 #include <VisualBench/WrappedBenchmark.h> 10 #include <VisualBench/WrappedBenchmark.h>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return SkIPoint::Make(w, h); 49 return SkIPoint::Make(w, h);
50 } 50 }
51 void onDraw(int loops, SkCanvas* canvas) override { 51 void onDraw(int loops, SkCanvas* canvas) override {
52 // We draw a big path to warm up the cpu, and then use perlin noise shad er to warm up the 52 // We draw a big path to warm up the cpu, and then use perlin noise shad er to warm up the
53 // gpu 53 // gpu
54 SkPaint paint; 54 SkPaint paint;
55 paint.setStyle(SkPaint::kStroke_Style); 55 paint.setStyle(SkPaint::kStroke_Style);
56 paint.setStrokeWidth(2); 56 paint.setStrokeWidth(2);
57 57
58 SkPaint perlinPaint; 58 SkPaint perlinPaint;
59 perlinPaint.setShader(SkPerlinNoiseShader::CreateTurbulence(0.1f, 0.1f, 1, 0, 59 perlinPaint.setShader(SkPerlinNoiseShader::MakeTurbulence(0.1f, 0.1f, 1, 0, nullptr));
60 nullptr))->u nref();
61 for (int i = 0; i < loops; i++) { 60 for (int i = 0; i < loops; i++) {
62 canvas->drawPath(fPath, paint); 61 canvas->drawPath(fPath, paint);
63 canvas->drawRect(fPerlinRect, perlinPaint); 62 canvas->drawRect(fPerlinRect, perlinPaint);
64 #if SK_SUPPORT_GPU 63 #if SK_SUPPORT_GPU
65 // Ensure the GrContext doesn't batch across draw loops. 64 // Ensure the GrContext doesn't batch across draw loops.
66 if (GrContext* context = canvas->getGrContext()) { 65 if (GrContext* context = canvas->getGrContext()) {
67 context->flush(); 66 context->flush();
68 } 67 }
69 #endif 68 #endif
70 } 69 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 179 }
181 180
182 SkString name = SkOSPath::Basename(path.c_str()); 181 SkString name = SkOSPath::Basename(path.c_str());
183 fSourceType = "skp"; 182 fSourceType = "skp";
184 fBenchType = "playback"; 183 fBenchType = "playback";
185 return new VisualSKPBench(name.c_str(), pic.get()); 184 return new VisualSKPBench(name.c_str(), pic.get());
186 } 185 }
187 186
188 return nullptr; 187 return nullptr;
189 } 188 }
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tools/debugger/SkDrawCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698