Flutter Engine
The Flutter Engine
Benchmark.cpp
Go to the documentation of this file.
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 */
7
8#include "bench/Benchmark.h"
9
13
14template BenchRegistry* BenchRegistry::gHead;
15
17
18const char* Benchmark::getName() {
19 return this->onGetName();
20}
21
23 return this->onGetUniqueName();
24}
25
27 return this->onGetSize();
28}
29
31 this->onDelayedSetup();
32}
33
35 this->onPerCanvasPreDraw(canvas);
36}
37
39 this->onPreDraw(canvas);
40}
41
43 this->onPostDraw(canvas);
44}
45
47 this->onPerCanvasPostDraw(canvas);
48}
49
50void Benchmark::draw(int loops, SkCanvas* canvas) {
51 SkAutoCanvasRestore ar(canvas, true/*save now*/);
52 this->onDraw(loops, canvas);
53}
54
56 paint->setAntiAlias(true);
57}
58
60 return SkISize::Make(640, 480);
61}
virtual void onPreDraw(SkCanvas *)
Definition: Benchmark.h:104
void delayedSetup()
Definition: Benchmark.cpp:30
virtual void onPerCanvasPostDraw(SkCanvas *)
Definition: Benchmark.h:103
virtual SkISize onGetSize()
Definition: Benchmark.cpp:59
void draw(int loops, SkCanvas *)
Definition: Benchmark.cpp:50
void postDraw(SkCanvas *)
Definition: Benchmark.cpp:42
virtual void onDraw(int loops, SkCanvas *)=0
SkISize getSize()
Definition: Benchmark.cpp:26
void perCanvasPreDraw(SkCanvas *)
Definition: Benchmark.cpp:34
const char * getName()
Definition: Benchmark.cpp:18
virtual void onDelayedSetup()
Definition: Benchmark.h:101
virtual void onPerCanvasPreDraw(SkCanvas *)
Definition: Benchmark.h:102
virtual void onPostDraw(SkCanvas *)
Definition: Benchmark.h:105
void perCanvasPostDraw(SkCanvas *)
Definition: Benchmark.cpp:46
virtual void setupPaint(SkPaint *paint)
Definition: Benchmark.cpp:55
virtual const char * onGetUniqueName()
Definition: Benchmark.h:100
virtual const char * onGetName()=0
void preDraw(SkCanvas *)
Definition: Benchmark.cpp:38
const char * getUniqueName()
Definition: Benchmark.cpp:22
const Paint & paint
Definition: color_source.cc:38
Definition: SkSize.h:16
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20