Chromium Code Reviews| Index: bench/nanobench.cpp |
| diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp |
| index 55ef34e79de41ed3910efd10f1e89e6a830958c5..fdf374601e221b72ed133a8bb3b1e1362bf47176 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,17 @@ 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(), encoded); |
|
scroggo
2016/06/02 18:51:50
nit: Should we std::move(encoded)?
Also, should t
msarett
2016/06/02 19:34:39
Yes and yes. Done for both.
|
| + } |
| + } |
| + |
| return nullptr; |
| } |
| @@ -960,6 +976,7 @@ private: |
| SkTArray<SkString> fSKPs; |
| SkTArray<bool> fUseMPDs; |
| SkTArray<SkString> fImages; |
| + SkTArray<SkString> fColorImages; |
| SkTArray<SkColorType, true> fColorTypes; |
| SkScalar fZoomMax; |
| double fZoomPeriodMs; |
| @@ -975,6 +992,7 @@ private: |
| int fCurrentCodec; |
| int fCurrentAndroidCodec; |
| int fCurrentBRDImage; |
| + int fCurrentColorImage; |
| int fCurrentColorType; |
| int fCurrentAlphaType; |
| int fCurrentSubsetType; |