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

Unified Diff: bench/DecodingSubsetBench.cpp

Issue 1160953002: Subset decoding benchmarks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added FIXME Created 5 years, 6 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 | « bench/DecodingSubsetBench.h ('k') | bench/nanobench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/DecodingSubsetBench.cpp
diff --git a/bench/DecodingSubsetBench.cpp b/bench/DecodingSubsetBench.cpp
deleted file mode 100644
index dc3c9f39cc5dbc7d2b14644a3b0a88dc5cbde00f..0000000000000000000000000000000000000000
--- a/bench/DecodingSubsetBench.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "DecodingSubsetBench.h"
-#include "SkData.h"
-#include "SkImageDecoder.h"
-#include "SkOSFile.h"
-#include "SkStream.h"
-
-/*
- *
- * This benchmark is designed to test the performance of image subset decoding.
- * It is invoked from the nanobench.cpp file.
- *
- */
-DecodingSubsetBench::DecodingSubsetBench(SkString path, SkColorType colorType,
- const int divisor)
- : fColorType(colorType)
- , fDivisor(divisor)
-{
- // Parse filename and the color type to give the benchmark a useful name
- SkString baseName = SkOSPath::Basename(path.c_str());
- const char* colorName;
- switch(colorType) {
- case kN32_SkColorType:
- colorName = "N32";
- break;
- case kRGB_565_SkColorType:
- colorName = "565";
- break;
- case kAlpha_8_SkColorType:
- colorName = "Alpha8";
- break;
- default:
- colorName = "Unknown";
- }
- fName.printf("DecodeSubset_%dx%d_%s_%s", fDivisor, fDivisor,
- baseName.c_str(), colorName);
-
- // Perform the decode setup
- SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str()));
- fStream.reset(new SkMemoryStream(encoded));
- fDecoder.reset(SkImageDecoder::Factory(fStream));
-}
-
-const char* DecodingSubsetBench::onGetName() {
- return fName.c_str();
-}
-
-bool DecodingSubsetBench::isSuitableFor(Backend backend) {
- return kNonRendering_Backend == backend;
-}
-
-void DecodingSubsetBench::onDraw(const int n, SkCanvas* canvas) {
- for (int i = 0; i < n; i++) {
- int w, h;
- fDecoder->buildTileIndex(fStream->duplicate(), &w, &h);
- // Divide the image into subsets and decode each subset
- const int sW = w / fDivisor;
- const int sH = h / fDivisor;
- for (int y = 0; y < h; y += sH) {
- for (int x = 0; x < w; x += sW) {
- SkBitmap bitmap;
- SkIRect rect = SkIRect::MakeXYWH(x, y, sW, sH);
- fDecoder->decodeSubset(&bitmap, rect, fColorType);
- }
- }
- }
-}
« no previous file with comments | « bench/DecodingSubsetBench.h ('k') | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698