Index: bench/nanobench.cpp |
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp |
index 054fbb27b1a795b3f22d2c03afc8a9d6e9d14cf1..dc27743a7b08015894db29a6d80940776d307b78 100644 |
--- a/bench/nanobench.cpp |
+++ b/bench/nanobench.cpp |
@@ -603,13 +603,21 @@ 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()) { |
- // This indicates that conversion to the requested color type is not supported for the |
- // particular image. |
+ SkIRect subset = SkIRect::MakeXYWH(0, 0, brd->width(), brd->height()); |
+ SkImageInfo info; |
+ if (!brd->prepareRegion(subset, 1, colorType, false, &info)) { |
+ // This indicates that conversion to the requested color type is not supported |
+ // or another parameter is invalid. |
return false; |
} |
+ if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy) { |
+ SkBitmap bitmap; |
+ if (!brd->decodeRegion(bitmap) || colorType != bitmap.colorType()) { |
+ // This indicates that conversion to the requested color type is not |
+ // supported for the particular image. |
+ return false; |
+ } |
+ } |
if (sampleSize * minOutputSize > (uint32_t) brd->width() || sampleSize * minOutputSize > |
(uint32_t) brd->height()) { |