diff options
Diffstat (limited to 'bench')
-rw-r--r-- | bench/CodecBench.cpp | 5 | ||||
-rw-r--r-- | bench/CodecBenchPriv.h | 1 | ||||
-rw-r--r-- | bench/nanobench.cpp | 8 |
3 files changed, 11 insertions, 3 deletions
diff --git a/bench/CodecBench.cpp b/bench/CodecBench.cpp index f72294e246..a1788ee0cc 100644 --- a/bench/CodecBench.cpp +++ b/bench/CodecBench.cpp @@ -51,17 +51,20 @@ void CodecBench::onDelayedSetup() { void CodecBench::onDraw(int n, SkCanvas* canvas) { std::unique_ptr<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)); #ifdef SK_DEBUG const SkCodec::Result result = #endif codec->getPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(), - &options); + &options, colorTable, &colorCount); SkASSERT(result == SkCodec::kSuccess || result == SkCodec::kIncompleteInput); } diff --git a/bench/CodecBenchPriv.h b/bench/CodecBenchPriv.h index d0eead33e0..5028573ad2 100644 --- a/bench/CodecBenchPriv.h +++ b/bench/CodecBenchPriv.h @@ -19,7 +19,6 @@ inline const char* color_type_to_str(SkColorType colorType) { case kGray_8_SkColorType: return "Gray8"; case kIndex_8_SkColorType: - SkASSERT(false); return "Index8"; case kAlpha_8_SkColorType: return "Alpha8"; diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index e67415e88c..6c60aa81af 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -630,6 +630,7 @@ public: if (!FLAGS_simpleCodec) { fColorTypes.push_back(kRGB_565_SkColorType); fColorTypes.push_back(kAlpha_8_SkColorType); + fColorTypes.push_back(kIndex_8_SkColorType); fColorTypes.push_back(kGray_8_SkColorType); } } @@ -858,8 +859,13 @@ public: const size_t rowBytes = info.minRowBytes(); SkAutoMalloc storage(info.getSafeSize(rowBytes)); + // Used if fCurrentColorType is kIndex_8_SkColorType + int colorCount = 256; + SkPMColor colors[256]; + const SkCodec::Result result = codec->getPixels( - info, storage.get(), rowBytes); + info, storage.get(), rowBytes, nullptr, colors, + &colorCount); switch (result) { case SkCodec::kSuccess: case SkCodec::kIncompleteInput: |