aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/AndroidCodecBench.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-02-11 06:45:51 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-11 06:45:51 -0800
commit84451024bfe06d138629dd7c27cf2ec0f9774dbe (patch)
treeb73d5b4a8a871088a73ecaa10627a9ad85dbb83a /bench/AndroidCodecBench.h
parentfff055cc5f9ca5015678f4f13a4f842084bd62d5 (diff)
Add AndroidCodecBench to time scaled decodes
Diffstat (limited to 'bench/AndroidCodecBench.h')
-rw-r--r--bench/AndroidCodecBench.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/bench/AndroidCodecBench.h b/bench/AndroidCodecBench.h
new file mode 100644
index 0000000000..fdbec5258a
--- /dev/null
+++ b/bench/AndroidCodecBench.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef AndroidCodecBench_DEFINED
+#define AndroidCodecBench_DEFINED
+
+#include "Benchmark.h"
+#include "SkData.h"
+#include "SkImageInfo.h"
+#include "SkRefCnt.h"
+#include "SkString.h"
+
+/**
+ * Time SkAndroidCodec.
+ */
+class AndroidCodecBench : public Benchmark {
+public:
+ // Calls encoded->ref()
+ AndroidCodecBench(SkString basename, SkData* encoded, int sampleSize);
+
+protected:
+ const char* onGetName() override;
+ bool isSuitableFor(Backend backend) override;
+ void onDraw(int n, SkCanvas* canvas) override;
+ void onDelayedSetup() override;
+
+private:
+ SkString fName;
+ SkAutoTUnref<SkData> fData;
+ const int fSampleSize;
+ SkImageInfo fInfo; // Set in onDelayedSetup.
+ SkAutoMalloc fPixelStorage; // Set in onDelayedSetup.
+ typedef Benchmark INHERITED;
+};
+#endif // AndroidCodecBench_DEFINED