epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
2 | * Copyright 2011 Google Inc. | ||||
3 | * | ||||
4 | * Use of this source code is governed by a BSD-style license that can be | ||||
5 | * found in the LICENSE file. | ||||
6 | */ | ||||
tfarina | bcbc178 | 2014-06-18 14:32:48 -0700 | [diff] [blame] | 7 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 8 | #include "Benchmark.h" |
tfarina | bcbc178 | 2014-06-18 14:32:48 -0700 | [diff] [blame] | 9 | |
mtklein | 38c0587 | 2014-10-02 13:03:58 -0700 | [diff] [blame] | 10 | #include "SkCanvas.h" |
reed@android.com | 4bc1983 | 2009-01-19 20:08:35 +0000 | [diff] [blame] | 11 | #include "SkPaint.h" |
reed@android.com | 0c9da39 | 2010-02-22 19:50:13 +0000 | [diff] [blame] | 12 | #include "SkParse.h" |
reed@android.com | 4bc1983 | 2009-01-19 20:08:35 +0000 | [diff] [blame] | 13 | |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 14 | template BenchRegistry* BenchRegistry::gHead; |
15 | |||||
Brian Osman | 1e4a4da | 2018-08-08 14:27:25 -0400 | [diff] [blame] | 16 | Benchmark::Benchmark() {} |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 17 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 18 | const char* Benchmark::getName() { |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 19 | return this->onGetName(); |
20 | } | ||||
21 | |||||
mtklein | 9628905 | 2014-09-10 12:05:59 -0700 | [diff] [blame] | 22 | const char* Benchmark::getUniqueName() { |
23 | return this->onGetUniqueName(); | ||||
24 | } | ||||
25 | |||||
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 26 | SkIPoint Benchmark::getSize() { |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 27 | return this->onGetSize(); |
28 | } | ||||
29 | |||||
joshualitt | 8a6697a | 2015-09-30 12:11:07 -0700 | [diff] [blame] | 30 | void Benchmark::delayedSetup() { |
31 | this->onDelayedSetup(); | ||||
bsalomon@google.com | 30e6d2c | 2012-08-13 14:03:31 +0000 | [diff] [blame] | 32 | } |
33 | |||||
robertphillips | 5b69377 | 2014-11-21 06:19:36 -0800 | [diff] [blame] | 34 | void Benchmark::perCanvasPreDraw(SkCanvas* canvas) { |
35 | this->onPerCanvasPreDraw(canvas); | ||||
36 | } | ||||
37 | |||||
joshualitt | 8a6697a | 2015-09-30 12:11:07 -0700 | [diff] [blame] | 38 | void Benchmark::preDraw(SkCanvas* canvas) { |
39 | this->onPreDraw(canvas); | ||||
40 | } | ||||
41 | |||||
42 | void Benchmark::postDraw(SkCanvas* canvas) { | ||||
43 | this->onPostDraw(canvas); | ||||
44 | } | ||||
45 | |||||
robertphillips | 5b69377 | 2014-11-21 06:19:36 -0800 | [diff] [blame] | 46 | void Benchmark::perCanvasPostDraw(SkCanvas* canvas) { |
47 | this->onPerCanvasPostDraw(canvas); | ||||
48 | } | ||||
49 | |||||
mtklein | a1ebeb2 | 2015-10-01 09:43:39 -0700 | [diff] [blame] | 50 | void Benchmark::draw(int loops, SkCanvas* canvas) { |
mtklein | 38c0587 | 2014-10-02 13:03:58 -0700 | [diff] [blame] | 51 | SkAutoCanvasRestore ar(canvas, true/*save now*/); |
commit-bot@chromium.org | 3361471 | 2013-12-03 18:17:16 +0000 | [diff] [blame] | 52 | this->onDraw(loops, canvas); |
reed@android.com | bd700c3 | 2009-01-05 03:34:50 +0000 | [diff] [blame] | 53 | } |
54 | |||||
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 55 | void Benchmark::setupPaint(SkPaint* paint) { |
kelvinly | 762c718 | 2014-07-09 12:25:27 -0700 | [diff] [blame] | 56 | paint->setAntiAlias(true); |
reed@android.com | 4bc1983 | 2009-01-19 20:08:35 +0000 | [diff] [blame] | 57 | } |
58 | |||||
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 59 | SkIPoint Benchmark::onGetSize() { |
reed@android.com | 0c9da39 | 2010-02-22 19:50:13 +0000 | [diff] [blame] | 60 | return SkIPoint::Make(640, 480); |
reed@android.com | f523e25 | 2009-01-26 23:15:37 +0000 | [diff] [blame] | 61 | } |