aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2014-06-12 17:40:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-12 17:40:00 -0700
commitbfefc7c95fc0e8ebd5000c68f6d16e1a3ea0e71e (patch)
tree9e68e04fa38c4e28ac478786bfe6d402a3bff239 /bench
parent9a8699f45c2bd8dac0c06829a06b6b244d19b6b2 (diff)
hide Config in SkImageDecoder -- use SkColorType instead
patch from issue 334613003 TBR=scroggo Author: reed@chromium.org Review URL: https://codereview.chromium.org/334793002
Diffstat (limited to 'bench')
-rw-r--r--bench/DecodeBench.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/bench/DecodeBench.cpp b/bench/DecodeBench.cpp
index a6ab4a5953..15a80b1b5c 100644
--- a/bench/DecodeBench.cpp
+++ b/bench/DecodeBench.cpp
@@ -11,22 +11,17 @@
#include "SkImageDecoder.h"
#include "SkOSFile.h"
#include "SkString.h"
+#include "sk_tool_utils.h"
DEFINE_string(decodeBenchFilename, "resources/CMYK.jpeg", "Path to image for DecodeBench.");
-static const char* gConfigName[] = {
- "ERROR", "a1", "a8", "index8", "565", "4444", "8888"
-};
-
class DecodeBench : public SkBenchmark {
- SkBitmap::Config fPrefConfig;
- SkString fName;
+ const SkColorType fPrefColorType;
+ SkString fName;
public:
- DecodeBench(SkBitmap::Config c) {
- fPrefConfig = c;
-
+ DecodeBench(SkColorType ct) : fPrefColorType(ct) {
SkString fname = SkOSPath::SkBasename(FLAGS_decodeBenchFilename[0]);
- fName.printf("decode_%s_%s", gConfigName[c], fname.c_str());
+ fName.printf("decode_%s_%s", sk_tool_utils::colortype_name(ct), fname.c_str());
}
virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
@@ -41,9 +36,7 @@ protected:
virtual void onDraw(const int loops, SkCanvas*) {
for (int i = 0; i < loops; i++) {
SkBitmap bm;
- SkImageDecoder::DecodeFile(FLAGS_decodeBenchFilename[0],
- &bm,
- fPrefConfig,
+ SkImageDecoder::DecodeFile(FLAGS_decodeBenchFilename[0], &bm, fPrefColorType,
SkImageDecoder::kDecodePixels_Mode);
}
}
@@ -52,6 +45,6 @@ private:
typedef SkBenchmark INHERITED;
};
-DEF_BENCH( return new DecodeBench(SkBitmap::kARGB_8888_Config); )
-DEF_BENCH( return new DecodeBench(SkBitmap::kRGB_565_Config); )
-DEF_BENCH( return new DecodeBench(SkBitmap::kARGB_4444_Config); )
+DEF_BENCH( return new DecodeBench(kN32_SkColorType); )
+DEF_BENCH( return new DecodeBench(kRGB_565_SkColorType); )
+DEF_BENCH( return new DecodeBench(kARGB_4444_SkColorType); )