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

Unified Diff: bench/subset/SubsetSingleBench.cpp

Issue 1430493005: Delete dead subset benches from nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Build fix: delete unused fUseCodec Created 5 years, 1 month 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 | « bench/subset/SubsetSingleBench.h ('k') | bench/subset/SubsetTranslateBench.h » ('j') | no next file with comments »
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 47a897fd83599ff70d995c074b230ece8d99c8eb..e30dd51e78a9b54d812ba04b9844583987e7a88a 100644
--- a/bench/subset/SubsetSingleBench.cpp
+++ b/bench/subset/SubsetSingleBench.cpp
@@ -26,14 +26,12 @@ SubsetSingleBench::SubsetSingleBench(const SkString& path,
uint32_t subsetWidth,
uint32_t subsetHeight,
uint32_t offsetLeft,
- uint32_t offsetTop,
- bool useCodec)
+ uint32_t offsetTop)
: fColorType(colorType)
, fSubsetWidth(subsetWidth)
, fSubsetHeight(subsetHeight)
, fOffsetLeft(offsetLeft)
, fOffsetTop(offsetTop)
- , fUseCodec(useCodec)
{
// Parse the filename
SkString baseName = SkOSPath::Basename(path.c_str());
@@ -41,7 +39,7 @@ SubsetSingleBench::SubsetSingleBench(const SkString& path,
// Choose an informative color name
const char* colorName = color_type_to_str(fColorType);
- fName.printf("%sSubsetSingle_%dx%d +%d_+%d_%s_%s", fUseCodec ? "Codec" : "Image", fSubsetWidth,
+ fName.printf("CodecSubsetSingle_%dx%d +%d_+%d_%s_%s", fSubsetWidth,
fSubsetHeight, fOffsetLeft, fOffsetTop, baseName.c_str(), colorName);
// Perform the decode setup
@@ -62,42 +60,30 @@ void SubsetSingleBench::onDraw(int n, SkCanvas* canvas) {
// used, it will be initialized by the codec.
int colorCount;
SkPMColor colors[256];
- if (fUseCodec) {
- for (int count = 0; count < n; count++) {
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(fStream->duplicate()));
- SkASSERT(SkCodec::kOutOfOrder_SkScanlineOrder != codec->getScanlineOrder());
- const SkImageInfo info = codec->getInfo().makeColorType(fColorType);
+ for (int count = 0; count < n; count++) {
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(fStream->duplicate()));
+ SkASSERT(SkCodec::kOutOfOrder_SkScanlineOrder != codec->getScanlineOrder());
+ const SkImageInfo info = codec->getInfo().makeColorType(fColorType);
- // The scanline decoder will handle subsetting in the x-dimension.
- SkIRect subset = SkIRect::MakeXYWH(fOffsetLeft, 0, fSubsetWidth,
- codec->getInfo().height());
- SkCodec::Options options;
- options.fSubset = &subset;
+ // The scanline decoder will handle subsetting in the x-dimension.
+ SkIRect subset = SkIRect::MakeXYWH(fOffsetLeft, 0, fSubsetWidth,
+ codec->getInfo().height());
+ SkCodec::Options options;
+ options.fSubset = &subset;
- SkDEBUGCODE(SkCodec::Result result =)
- codec->startScanlineDecode(info, &options, colors, &colorCount);
- SkASSERT(result == SkCodec::kSuccess);
+ SkDEBUGCODE(SkCodec::Result result =)
+ codec->startScanlineDecode(info, &options, colors, &colorCount);
+ SkASSERT(result == SkCodec::kSuccess);
- SkBitmap bitmap;
- SkImageInfo subsetInfo = info.makeWH(fSubsetWidth, fSubsetHeight);
- alloc_pixels(&bitmap, subsetInfo, colors, colorCount);
+ SkBitmap bitmap;
+ SkImageInfo subsetInfo = info.makeWH(fSubsetWidth, fSubsetHeight);
+ alloc_pixels(&bitmap, subsetInfo, colors, colorCount);
- SkDEBUGCODE(bool success = ) codec->skipScanlines(fOffsetTop);
- SkASSERT(success);
+ SkDEBUGCODE(bool success = ) codec->skipScanlines(fOffsetTop);
+ SkASSERT(success);
- SkDEBUGCODE(uint32_t lines = ) codec->getScanlines(bitmap.getPixels(), fSubsetHeight,
- bitmap.rowBytes());
- SkASSERT(lines == fSubsetHeight);
- }
- } else {
- for (int count = 0; count < n; count++) {
- SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStream));
- int width, height;
- SkAssertResult(decoder->buildTileIndex(fStream->duplicate(), &width, &height));
- SkBitmap bitmap;
- SkIRect rect = SkIRect::MakeXYWH(fOffsetLeft, fOffsetTop, fSubsetWidth,
- fSubsetHeight);
- SkAssertResult(decoder->decodeSubset(&bitmap, rect, fColorType));
- }
+ SkDEBUGCODE(uint32_t lines = ) codec->getScanlines(bitmap.getPixels(), fSubsetHeight,
+ bitmap.rowBytes());
+ SkASSERT(lines == fSubsetHeight);
}
}
« no previous file with comments | « bench/subset/SubsetSingleBench.h ('k') | bench/subset/SubsetTranslateBench.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698