diff options
author | msarett <msarett@google.com> | 2015-10-27 12:50:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-27 12:50:25 -0700 |
commit | 35e5d1b4495478ca3bede66914ae07f50a447c4d (patch) | |
tree | 1db71991433b478c83d50b36211c4683649c5336 /bench | |
parent | f7c0822911e736940a8690fb0553821561bf8ac7 (diff) |
Refactor SkBitmapRegionDecoderInterface for Android
The result SkBitmap, the pixel allocator, and the alpha
preference need to be communicated from the client to
the region decoder.
BUG=skia:
Review URL: https://codereview.chromium.org/1418093006
Diffstat (limited to 'bench')
-rw-r--r-- | bench/BitmapRegionDecoderBench.cpp | 6 | ||||
-rw-r--r-- | bench/nanobench.cpp | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/bench/BitmapRegionDecoderBench.cpp b/bench/BitmapRegionDecoderBench.cpp index 092693619b..70e3e760e0 100644 --- a/bench/BitmapRegionDecoderBench.cpp +++ b/bench/BitmapRegionDecoderBench.cpp @@ -61,10 +61,8 @@ void BitmapRegionDecoderBench::onDelayedSetup() { } void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) { - SkAutoTDelete<SkBitmap> bitmap; for (int i = 0; i < n; i++) { - bitmap.reset(fBRD->decodeRegion(fSubset.left(), fSubset.top(), fSubset.width(), - fSubset.height(), fSampleSize, fColorType)); - SkASSERT(nullptr != bitmap.get()); + SkBitmap bm; + SkAssertResult(fBRD->decodeRegion(&bm, nullptr, fSubset, fSampleSize, fColorType, false)); } } diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 054fbb27b1..de4545f2fa 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -603,9 +603,12 @@ static bool valid_brd_bench(SkData* encoded, SkBitmapRegionDecoderInterface::Str return false; } - SkAutoTDelete<SkBitmap> bitmap(brd->decodeRegion(0, 0, brd->width(), brd->height(), 1, - colorType)); - if (nullptr == bitmap.get() || colorType != bitmap->colorType()) { + SkBitmap bitmap; + if (!brd->decodeRegion(&bitmap, nullptr, SkIRect::MakeXYWH(0, 0, brd->width(), brd->height()), + 1, colorType, false)) { + return false; + } + if (colorType != bitmap.colorType()) { // This indicates that conversion to the requested color type is not supported for the // particular image. return false; |