aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/DecodingSubsetBench.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-02-13 09:05:41 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-13 09:05:42 -0800
commit95f192d19938b98a45dd1fa4112d965f60d10516 (patch)
treea0c6f343f0d97f7022c117139d1d1ac9597ab4ec /bench/DecodingSubsetBench.h
parenta8fcea0cd09080de45143f2726059398cd8b8049 (diff)
Adding new benchmark to test image decoding performance.
Diffstat (limited to 'bench/DecodingSubsetBench.h')
-rw-r--r--bench/DecodingSubsetBench.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/bench/DecodingSubsetBench.h b/bench/DecodingSubsetBench.h
new file mode 100644
index 0000000000..8034c8fb74
--- /dev/null
+++ b/bench/DecodingSubsetBench.h
@@ -0,0 +1,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.
+ */
+
+#include "Benchmark.h"
+#include "SkImageDecoder.h"
+#include "SkImageInfo.h"
+#include "SkStream.h"
+#include "SkString.h"
+
+/*
+ *
+ * This benchmark is designed to test the performance of image subset decoding.
+ * It is invoked from the nanobench.cpp file.
+ *
+ */
+class DecodingSubsetBench : public Benchmark {
+public:
+ DecodingSubsetBench(SkString path, SkColorType colorType,
+ const int divisor);
+
+protected:
+ const char* onGetName() SK_OVERRIDE;
+ bool isSuitableFor(Backend backend) SK_OVERRIDE;
+ void onDraw(const int n, SkCanvas* canvas) SK_OVERRIDE;
+
+private:
+ SkString fName;
+ SkColorType fColorType;
+ const int fDivisor;
+ SkAutoTDelete<SkMemoryStream> fStream;
+ SkAutoTDelete<SkImageDecoder> fDecoder;
+ typedef Benchmark INHERITED;
+};