diff options
author | msarett <msarett@google.com> | 2015-10-22 07:29:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-22 07:29:19 -0700 |
commit | 26ad17b8f872fc8bc18df7f49067edbd8b9799e8 (patch) | |
tree | ff8699a8e9614cc328011d172fdb8cd6b2fbdae2 /bench | |
parent | ed0935a28a29af7d3b16ac8d9365f291a335c6bd (diff) |
Implementation of SkBitmapRegionDecoder using SkAndroidCodec
Includes testing in DM and nanobench
BUG=skia:
Review URL: https://codereview.chromium.org/1402863002
Diffstat (limited to 'bench')
-rw-r--r-- | bench/BitmapRegionDecoderBench.cpp | 6 | ||||
-rw-r--r-- | bench/nanobench.cpp | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/bench/BitmapRegionDecoderBench.cpp b/bench/BitmapRegionDecoderBench.cpp index 0398b58420..092693619b 100644 --- a/bench/BitmapRegionDecoderBench.cpp +++ b/bench/BitmapRegionDecoderBench.cpp @@ -30,6 +30,9 @@ BitmapRegionDecoderBench::BitmapRegionDecoderBench(const char* baseName, SkData* case SkBitmapRegionDecoderInterface::kCanvas_Strategy: strategyName = "Canvas"; break; + case SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy: + strategyName = "AndroidCodec"; + break; default: SkASSERT(false); strategyName = ""; @@ -54,8 +57,7 @@ bool BitmapRegionDecoderBench::isSuitableFor(Backend backend) { } void BitmapRegionDecoderBench::onDelayedSetup() { - SkStreamRewindable* stream = new SkMemoryStream(fData); - fBRD.reset(SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(stream, fStrategy)); + fBRD.reset(SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(fData, fStrategy)); } void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) { diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 16523545fa..054fbb27b1 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -596,9 +596,8 @@ static bool valid_subset_bench(const SkString& path, SkColorType colorType, bool static bool valid_brd_bench(SkData* encoded, SkBitmapRegionDecoderInterface::Strategy strategy, SkColorType colorType, uint32_t sampleSize, uint32_t minOutputSize, int* width, int* height) { - SkStreamRewindable* stream = new SkMemoryStream(encoded); SkAutoTDelete<SkBitmapRegionDecoderInterface> brd( - SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(stream, strategy)); + SkBitmapRegionDecoderInterface::CreateBitmapRegionDecoder(encoded, strategy)); if (nullptr == brd.get()) { // This is indicates that subset decoding is not supported for a particular image format. return false; @@ -962,8 +961,9 @@ public: SkBitmapRegionDecoderInterface::Strategy fStrategy; const char* fName; } strategies[] = { - { SkBitmapRegionDecoderInterface::kOriginal_Strategy, "BRD" }, - { SkBitmapRegionDecoderInterface::kCanvas_Strategy, "BRD_canvas" }, + { SkBitmapRegionDecoderInterface::kOriginal_Strategy, "BRD" }, + { SkBitmapRegionDecoderInterface::kCanvas_Strategy, "BRD_canvas" }, + { SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy, "BRD_android_codec" }, }; // We intend to create benchmarks that model the use cases in |