Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GMBench.h
Go to the documentation of this file.
1/*
2 * Copyright 2014 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#ifndef GMBench_DEFINED
8#define GMBench_DEFINED
9
10#include "bench/Benchmark.h"
11#include "gm/gm.h"
13
14/**
15 * Runs a GM as a benchmark by repeatedly drawing the GM.
16 */
17class GMBench : public Benchmark {
18public:
19 GMBench(std::unique_ptr<skiagm::GM> gm);
20
22 return fGM->modifyGrContextOptions(options);
23 }
24
25protected:
26 const char* onGetName() override;
27 bool isSuitableFor(Backend backend) override;
28 void onPerCanvasPreDraw(SkCanvas*) override;
29 void onPerCanvasPostDraw(SkCanvas*) override;
30 void onDraw(int loops, SkCanvas*) override;
31 SkISize onGetSize() override;
32
33private:
34 std::unique_ptr<skiagm::GM> fGM;
35 SkString fName;
36 bool fGpuSetupFailed = false;
37
38 using INHERITED = Benchmark;
39};
40
41#endif
const char * options
void onPerCanvasPostDraw(SkCanvas *) override
Definition GMBench.cpp:36
SkISize onGetSize() override
Definition GMBench.cpp:55
void modifyGrContextOptions(GrContextOptions *options) override
Definition GMBench.h:21
void onDraw(int loops, SkCanvas *) override
Definition GMBench.cpp:44
const char * onGetName() override
Definition GMBench.cpp:19
void onPerCanvasPreDraw(SkCanvas *) override
Definition GMBench.cpp:27
bool isSuitableFor(Backend backend) override
Definition GMBench.cpp:23