Index: bench/CodecBench.cpp |
diff --git a/bench/CodecBench.cpp b/bench/CodecBench.cpp |
index 66831fb24c6bc16b9696c5951a291f92e09f87e6..689b2d82ae815ac0d73638211b243fe31b44e929 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?"); |
+ |
CodecBench::CodecBench(SkString baseName, SkData* encoded, SkColorType colorType, |
SkAlphaType alphaType) |
: fColorType(colorType) |
@@ -50,11 +54,15 @@ void CodecBench::onDraw(int n, SkCanvas* canvas) { |
for (int i = 0; i < n; i++) { |
colorCount = 256; |
codec.reset(SkCodec::NewFromData(fData)); |
+ SkCodec::Options options; |
msarett
2016/01/08 21:59:41
Can we add this code outside of the loop? I bet t
mtklein_C
2016/01/08 22:03:37
Done.
|
+ if (FLAGS_zero_init) { |
+ options.fZeroInitialized = SkCodec::kYes_ZeroInitialized; |
+ } |
#ifdef SK_DEBUG |
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); |
} |