aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/VisualBench/VisualSKPBench.h
blob: cc35deaac59bbfad8ed026b1019f56bbb0378c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 */

#ifndef VisualSKPBench_DEFINED
#define VisualSKPBench_DEFINED

#include "Benchmark.h"
#include "SkCanvas.h"
#include "SkPicture.h"

/**
 * Runs an SkPicture as a benchmark by repeatedly drawing it
 */
class VisualSKPBench : public Benchmark {
public:
    VisualSKPBench(const char* name, const SkPicture*);

protected:
    const char* onGetName() override;
    const char* onGetUniqueName() override;
    bool isSuitableFor(Backend backend) override;
    void onDraw(const int loops, SkCanvas* canvas) override;

private:
    SkAutoTUnref<const SkPicture> fPic;
    SkString fName;
    SkString fUniqueName;

    typedef Benchmark INHERITED;
};

#endif