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

Side by Side Diff: tools/VisualBench/CpuWrappedBenchmark.h

Issue 1395703002: small tidy of benchmarkstream (Closed) Base URL: https://skia.googlesource.com/skia.git@vb4b
Patch Set: remove debug print Created 5 years, 2 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 | « no previous file | tools/VisualBench/TimingStateMachine.h » ('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 #ifndef CpuWrappedBenchmark_DEFINED 9 #ifndef CpuWrappedBenchmark_DEFINED
10 #define CpuWrappedBenchmark_DEFINED 10 #define CpuWrappedBenchmark_DEFINED
11 11
12 #include "Benchmark.h" 12 #include "Benchmark.h"
13 #include "SkSurface.h" 13 #include "SkSurface.h"
14 14
15 class CpuWrappedBenchmark : public Benchmark { 15 class CpuWrappedBenchmark : public Benchmark {
16 public: 16 public:
17 // Takes ownership of caller's ref on `bench`. 17 // Takes ownership of caller's ref on `bench`.
18 explicit CpuWrappedBenchmark(Benchmark* bench) : fBench(bench) {} 18 explicit CpuWrappedBenchmark(Benchmark* bench) : fBench(bench) {}
19 19
20 const char* onGetName() override { return fBench->getName(); } 20 const char* onGetName() override { return fBench->getName(); }
21 const char* onGetUniqueName() override { return fBench->getUniqueName(); } 21 const char* onGetUniqueName() override { return fBench->getUniqueName(); }
22 22
23 void onDelayedSetup() override { fBench->delayedSetup(); }
24 void onPerCanvasPreDraw(SkCanvas* canvas) override { fBench->perCanvasPreDra w(canvas); }
25 void onPreDraw(SkCanvas* canvas) override { fBench->preDraw(canvas); }
26 void onPostDraw(SkCanvas* canvas) override { fBench->postDraw(canvas); }
27 void onPerCanvasPostDraw(SkCanvas* canvas) override { fBench->perCanvasPostD raw(canvas); }
28
23 void onDraw(int loops, SkCanvas* canvas) override { 29 void onDraw(int loops, SkCanvas* canvas) override {
24 // TODO: use onPreDraw() to move offscreen allocation/deallocation out o f timing. 30 // TODO: use onPreDraw() to move offscreen allocation/deallocation out o f timing.
25 SkAutoTUnref<SkSurface> offscreen(SkSurface::NewRaster(canvas->imageInfo ())); 31 SkAutoTUnref<SkSurface> offscreen(SkSurface::NewRaster(canvas->imageInfo ()));
26 32
27 fBench->draw(loops, offscreen->getCanvas()); 33 fBench->draw(loops, offscreen->getCanvas());
28 SkAutoTUnref<SkImage> image(offscreen->newImageSnapshot()); 34 SkAutoTUnref<SkImage> image(offscreen->newImageSnapshot());
29 canvas->drawImage(image, 0,0); 35 canvas->drawImage(image, 0,0);
30 } 36 }
31 37
38 virtual SkIPoint onGetSize() override { return fBench->getSize(); }
39
32 private: 40 private:
33 SkAutoTUnref<Benchmark> fBench; 41 SkAutoTUnref<Benchmark> fBench;
34 }; 42 };
35 43
36 #endif//CpuWrappedBenchmark_DEFINED 44 #endif//CpuWrappedBenchmark_DEFINED
OLDNEW
« no previous file with comments | « no previous file | tools/VisualBench/TimingStateMachine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698