Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: bench/nanobench.cpp

Issue 1418093006: Refactor SkBitmapRegionDecoderInterface for Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()) {

Powered by Google App Engine
This is Rietveld 408576698