blob: 0b0e008d633b33598cf86b314e84bedb72ce1669 [file] [log] [blame]
mtklein92007582014-08-01 07:46:52 -07001/*
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
8#ifndef SKPBench_DEFINED
9#define SKPBench_DEFINED
10
11#include "Benchmark.h"
12#include "SkCanvas.h"
13#include "SkPicture.h"
14
15/**
16 * Runs an SkPicture as a benchmark by repeatedly drawing it scaled inside a device clip.
17 */
18class SKPBench : public Benchmark {
19public:
20 SKPBench(const char* name, const SkPicture*, const SkIRect& devClip, SkScalar scale);
21
22protected:
23 virtual const char* onGetName() SK_OVERRIDE;
mtklein96289052014-09-10 12:05:59 -070024 virtual const char* onGetUniqueName() SK_OVERRIDE;
mtklein92007582014-08-01 07:46:52 -070025 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE;
26 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE;
27 virtual SkIPoint onGetSize() SK_OVERRIDE;
28
29private:
30 SkAutoTUnref<const SkPicture> fPic;
31 const SkIRect fClip;
32 const SkScalar fScale;
33 SkString fName;
mtklein96289052014-09-10 12:05:59 -070034 SkString fUniqueName;
mtklein92007582014-08-01 07:46:52 -070035
36 typedef Benchmark INHERITED;
37};
38
39#endif