VisualBench::VisualBench(void* hwnd, int argc, char** argv) : INHERITED(hwnd) , fCurrentPictureIdx(-1) , fCurrentSample(0) , fCurrentFrame(0) , fFlushes(1) , fLoops(1) , fState(kPreWarmLoops_State) { SkCommandLineFlags::Parse(argc, argv); // read all the skp file names. for (int i = 0; i < FLAGS_skps.count(); i++) { if (SkStrEndsWith(FLAGS_skps[i], ".skp")) { fRecords.push_back().fFilename = FLAGS_skps[i]; } else { SkOSFile::Iter it(FLAGS_skps[i], ".skp"); SkString path; while (it.next(&path)) { fRecords.push_back().fFilename = SkOSPath::Join(FLAGS_skps[i], path.c_str());; } } } if (fRecords.empty()) { SkDebugf("no valid skps found\n"); } this->setTitle(); this->setupBackend(); // Print header SkDebugf("curr/maxrss\tloops\tflushes\tmin\tmedian\tmean\tmax\tstddev\tbench\n"); }
static int process_input(const char* input, const SkString* outputDir, sk_tools::PictureRenderer& renderer, sk_tools::ImageResultsSummary *jsonSummaryPtr) { SkOSFile::Iter iter(input, "skp"); SkString inputFilename; int failures = 0; SkDebugf("process_input, %s\n", input); if (iter.next(&inputFilename)) { do { SkString inputPath; SkString inputAsSkString(input); sk_tools::make_filepath(&inputPath, inputAsSkString, inputFilename); if (!render_picture(inputPath, outputDir, renderer, jsonSummaryPtr)) { ++failures; } } while(iter.next(&inputFilename)); } else if (SkStrEndsWith(input, ".skp")) { SkString inputPath(input); if (!render_picture(inputPath, outputDir, renderer, jsonSummaryPtr)) { ++failures; } } else { SkString warning; warning.printf("Warning: skipping %s\n", input); SkDebugf(warning.c_str()); } return failures; }
static int process_input(const char* input, sk_tools::PictureBenchmark& benchmark) { SkString inputAsSkString(input); SkOSFile::Iter iter(input, "skp"); SkString inputFilename; int failures = 0; if (iter.next(&inputFilename)) { do { SkString inputPath; sk_tools::make_filepath(&inputPath, inputAsSkString, inputFilename); if (!run_single_benchmark(inputPath, benchmark)) { ++failures; } } while(iter.next(&inputFilename)); } else if (SkStrEndsWith(input, ".skp")) { if (!run_single_benchmark(inputAsSkString, benchmark)) { ++failures; } } else { SkString warning; warning.printf("Warning: skipping %s\n", input); gLogger.logError(warning); } return failures; }
static int process_input(const SkString& input, const SkString* outputDir, sk_tools::PictureRenderer& renderer, bool validate, bool writeWholeImage, int clones) { SkOSFile::Iter iter(input.c_str(), "skp"); SkString inputFilename; int failures = 0; SkDebugf("process_input, %s\n", input.c_str()); if (iter.next(&inputFilename)) { do { SkString inputPath; sk_tools::make_filepath(&inputPath, input, inputFilename); if (!render_picture(inputPath, outputDir, renderer, validate, writeWholeImage, clones)) { ++failures; } } while(iter.next(&inputFilename)); } else if (SkStrEndsWith(input.c_str(), ".skp")) { SkString inputPath(input); if (!render_picture(inputPath, outputDir, renderer, validate, writeWholeImage, clones)) { ++failures; } } else { SkString warning; warning.printf("Warning: skipping %s\n", input.c_str()); SkDebugf(warning.c_str()); } return failures; }
static int process_input(const char* input, const SkString* writePath, const SkString* mismatchPath, sk_tools::PictureRenderer& renderer, sk_tools::ImageResultsAndExpectations *jsonSummaryPtr) { SkOSFile::Iter iter(input, "skp"); SkString inputFilename; int failures = 0; SkDebugf("process_input, %s\n", input); if (iter.next(&inputFilename)) { do { SkString inputPath = SkOSPath::Join(input, inputFilename.c_str()); if (!render_picture(inputPath, writePath, mismatchPath, renderer, jsonSummaryPtr)) { ++failures; } } while(iter.next(&inputFilename)); } else if (SkStrEndsWith(input, ".skp")) { SkString inputPath(input); if (!render_picture(inputPath, writePath, mismatchPath, renderer, jsonSummaryPtr)) { ++failures; } } else { SkString warning; warning.printf("Warning: skipping %s\n", input); SkDebugf("%s", warning.c_str()); } return failures; }
/** * Return true if the filename represents an image. */ static bool is_image_file(const char* filename) { const char* gImageExtensions[] = { ".png", ".PNG", ".jpg", ".JPG", ".jpeg", ".JPEG", ".bmp", ".BMP", ".webp", ".WEBP", ".ico", ".ICO", ".wbmp", ".WBMP", ".gif", ".GIF" }; for (size_t i = 0; i < SK_ARRAY_COUNT(gImageExtensions); ++i) { if (SkStrEndsWith(filename, gImageExtensions[i])) { return true; } } return false; }
// FIXME: SkScaledCodec is currently only supported for types used by BRD // https://bug.skia.org/4428 static bool supports_scaled_codec(const char path[]) { static const char* const exts[] = { "jpg", "jpeg", "png", "webp" "JPG", "JPEG", "PNG", "WEBP" }; for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { if (SkStrEndsWith(path, exts[i])) { return true; } } return false; }
BenchmarkStream() : fCurrentSKP(0) { for (int i = 0; i < FLAGS_skps.count(); i++) { if (SkStrEndsWith(FLAGS_skps[i], ".skp")) { fSKPs.push_back() = FLAGS_skps[i]; } else { SkOSFile::Iter it(FLAGS_skps[i], ".skp"); SkString path; while (it.next(&path)) { fSKPs.push_back() = SkOSPath::Join(FLAGS_skps[0], path.c_str()); } } } }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QStringList argList = a.arguments(); if (argList.count() <= 0) { return -1; // should at least have command name } SkString input; QStringList::const_iterator iter = argList.begin(); SkString commandName(iter->toAscii().data()); ++iter; // skip the command name for ( ; iter != argList.end(); ++iter) { if (0 == iter->compare("--help") || 0 == iter->compare("-h")) { usage(commandName.c_str()); return -1; } else if (input.isEmpty()) { input = SkString(iter->toAscii().data()); } else { usage(commandName.c_str()); return -1; } } SkDebuggerGUI w; if (!input.isEmpty()) { if (SkStrEndsWith(input.c_str(), ".skp")) { w.openFile(input.c_str()); } else { w.setupDirectoryWidget(input.c_str()); } } w.show(); return a.exec(); }