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

Unified Diff: bench/subset/SubsetSingleBench.cpp

Issue 1387233002: Update Subset benches to support interlacing and fix bugs (Closed) Base URL: https://skia.googlesource.com/skia.git@limitScaled
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
« no previous file with comments | « no previous file | bench/subset/SubsetTranslateBench.cpp » ('j') | bench/subset/SubsetTranslateBench.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/subset/SubsetSingleBench.cpp
diff --git a/bench/subset/SubsetSingleBench.cpp b/bench/subset/SubsetSingleBench.cpp
index 232c159a0baea1030e442bc2365b6702991126f4..3ec12f5e3388eb664c163925d41e13c0506782da 100644
--- a/bench/subset/SubsetSingleBench.cpp
+++ b/bench/subset/SubsetSingleBench.cpp
@@ -66,7 +66,6 @@ void SubsetSingleBench::onDraw(int n, SkCanvas* canvas) {
for (int count = 0; count < n; count++) {
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(fStream->duplicate()));
const SkImageInfo info = codec->getInfo().makeColorType(fColorType);
- SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
codec->startScanlineDecode(info, nullptr, colors, &colorCount);
SkBitmap bitmap;
@@ -74,11 +73,38 @@ void SubsetSingleBench::onDraw(int n, SkCanvas* canvas) {
alloc_pixels(&bitmap, subsetInfo, colors, colorCount);
codec->skipScanlines(fOffsetTop);
- uint32_t bpp = info.bytesPerPixel();
- for (uint32_t y = 0; y < fSubsetHeight; y++) {
- codec->getScanlines(row.get(), 1, 0);
- memcpy(bitmap.getAddr(0, y), row.get() + fOffsetLeft * bpp,
- fSubsetWidth * bpp);
+
+ const uint32_t bpp = info.bytesPerPixel();
+
+ switch (codec->getScanlineOrder()) {
+ case SkCodec::kTopDown_SkScanlineOrder: {
+ SkAutoTDeleteArray<uint8_t> row(new uint8_t[info.minRowBytes()]);
scroggo 2015/10/06 20:36:04 This got moved because it's not needed for kNone.
msarett 2015/10/06 21:58:52 Acknowledged.
+ for (uint32_t y = 0; y < fSubsetHeight; y++) {
scroggo 2015/10/06 20:36:04 This code should be unchanged; it's just now insid
msarett 2015/10/06 21:58:52 Acknowledged.
+ codec->getScanlines(row.get(), 1, 0);
+ memcpy(bitmap.getAddr(0, y), row.get() + fOffsetLeft * bpp,
+ fSubsetWidth * bpp);
+ }
+ break;
+ }
+ case SkCodec::kNone_SkScanlineOrder: {
+ // decode all scanlines that intersect the subset, and copy the subset
+ // into the output.
+ SkImageInfo stripeInfo = info.makeWH(info.width(), fSubsetHeight);
+ SkBitmap stripeBm;
+ alloc_pixels(&stripeBm, stripeInfo, colors, colorCount);
+
+ codec->getScanlines(stripeBm.getPixels(), fSubsetHeight, stripeBm.rowBytes());
+ for (uint32_t y = 0; y < fSubsetHeight; y++) {
+ memcpy(bitmap.getAddr(0, y), stripeBm.getAddr(fOffsetLeft, y),
+ fSubsetWidth * bpp);
+ }
+ break;
+ }
+ default:
+ // We currently are only testing kTopDown and kNone, which are the only
+ // two used by the subsets we care about. skbug.com/4428
+ SkASSERT(false);
+
}
}
} else {
« no previous file with comments | « no previous file | bench/subset/SubsetTranslateBench.cpp » ('j') | bench/subset/SubsetTranslateBench.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698