Chromium Code Reviews| Index: bench/CodecBench.cpp |
| diff --git a/bench/CodecBench.cpp b/bench/CodecBench.cpp |
| index 66831fb24c6bc16b9696c5951a291f92e09f87e6..fc52edfb07bcda61fe6b40921e00c71a110608c6 100644 |
| --- a/bench/CodecBench.cpp |
| +++ b/bench/CodecBench.cpp |
| @@ -9,8 +9,12 @@ |
| #include "CodecBenchPriv.h" |
| #include "SkBitmap.h" |
| #include "SkCodec.h" |
| +#include "SkCommandLineFlags.h" |
| #include "SkOSFile.h" |
| +// Actually zeroing the memory would throw off timing, so we just lie. |
| +DEFINE_bool(zero_init, false, "Pretend our destination is zero-intialized, simulating Android?"); |
|
scroggo
2016/01/08 22:20:29
Hahaha - we could also add this as another option
|
| + |
| CodecBench::CodecBench(SkString baseName, SkData* encoded, SkColorType colorType, |
| SkAlphaType alphaType) |
| : fColorType(colorType) |
| @@ -47,6 +51,10 @@ void CodecBench::onDraw(int n, SkCanvas* canvas) { |
| SkAutoTDelete<SkCodec> codec; |
| SkPMColor colorTable[256]; |
| int colorCount; |
| + SkCodec::Options options; |
| + if (FLAGS_zero_init) { |
| + options.fZeroInitialized = SkCodec::kYes_ZeroInitialized; |
| + } |
| for (int i = 0; i < n; i++) { |
| colorCount = 256; |
| codec.reset(SkCodec::NewFromData(fData)); |
| @@ -54,7 +62,7 @@ void CodecBench::onDraw(int n, SkCanvas* canvas) { |
| const SkCodec::Result result = |
| #endif |
| codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(), |
| - nullptr, colorTable, &colorCount); |
| + &options, colorTable, &colorCount); |
| SkASSERT(result == SkCodec::kSuccess |
| || result == SkCodec::kIncompleteInput); |
| } |