Index: bench/nanobench.cpp |
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp |
index 55ef34e79de41ed3910efd10f1e89e6a830958c5..a7e9ebb855a4d8d8558ecbacc3650b3c01001a44 100644 |
--- a/bench/nanobench.cpp |
+++ b/bench/nanobench.cpp |
@@ -14,6 +14,7 @@ |
#include "BitmapRegionDecoderBench.h" |
#include "CodecBench.h" |
#include "CodecBenchPriv.h" |
+#include "ColorCodecBench.h" |
#include "CrashHandler.h" |
#include "GMBench.h" |
#include "ProcStats.h" |
@@ -558,6 +559,7 @@ public: |
, fCurrentCodec(0) |
, fCurrentAndroidCodec(0) |
, fCurrentBRDImage(0) |
+ , fCurrentColorImage(0) |
, fCurrentColorType(0) |
, fCurrentAlphaType(0) |
, fCurrentSubsetType(0) |
@@ -602,6 +604,9 @@ public: |
if (!CollectImages(FLAGS_images, &fImages)) { |
exit(1); |
} |
+ if (!CollectImages(FLAGS_colorImages, &fColorImages)) { |
+ exit(1); |
+ } |
// Choose the candidate color types for image decoding |
const SkColorType colorTypes[] = |
@@ -917,6 +922,20 @@ public: |
fCurrentColorType = 0; |
} |
+ while (fCurrentColorImage < fColorImages.count()) { |
+ fSourceType = "colorimage"; |
+ fBenchType = "skcolorcodec"; |
+ const SkString& path = fColorImages[fCurrentColorImage]; |
+ fCurrentColorImage++; |
+ sk_sp<SkData> encoded = SkData::MakeFromFileName(path.c_str()); |
+ if (encoded) { |
+ return new ColorCodecBench(SkOSPath::Basename(path.c_str()).c_str(), |
+ std::move(encoded)); |
+ } else { |
+ SkDebugf("Could not read file %s.\n", path.c_str()); |
+ } |
+ } |
+ |
return nullptr; |
} |
@@ -960,6 +979,7 @@ private: |
SkTArray<SkString> fSKPs; |
SkTArray<bool> fUseMPDs; |
SkTArray<SkString> fImages; |
+ SkTArray<SkString> fColorImages; |
SkTArray<SkColorType, true> fColorTypes; |
SkScalar fZoomMax; |
double fZoomPeriodMs; |
@@ -975,6 +995,7 @@ private: |
int fCurrentCodec; |
int fCurrentAndroidCodec; |
int fCurrentBRDImage; |
+ int fCurrentColorImage; |
int fCurrentColorType; |
int fCurrentAlphaType; |
int fCurrentSubsetType; |