Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1004)

Unified Diff: bench/DecodeBench.cpp

Issue 334793002: hide Config in SkImageDecoder -- use SkColorType instead (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | experimental/PdfViewer/chop_transparency_main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/DecodeBench.cpp
diff --git a/bench/DecodeBench.cpp b/bench/DecodeBench.cpp
index a6ab4a5953bcf7927f5356284cd04a3397072a2d..15a80b1b5c8a48406fcbc137fbef60c3375a6483 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); )
« no previous file with comments | « no previous file | experimental/PdfViewer/chop_transparency_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698