本文整理汇总了C++中SkISize::setEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ SkISize::setEmpty方法的具体用法?C++ SkISize::setEmpty怎么用?C++ SkISize::setEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkISize
的用法示例。
在下文中一共展示了SkISize::setEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse_commandline
static void parse_commandline(int argc, char* const argv[], SkTArray<SkString>* inputs,
sk_tools::PictureRenderer*& renderer, SkString*& outputDir,
bool* validate, bool* writeWholeImage,
int* clones){
const char* argv0 = argv[0];
char* const* stop = argv + argc;
sk_tools::PictureRenderer::SkDeviceTypes deviceType =
sk_tools::PictureRenderer::kBitmap_DeviceType;
bool usePipe = false;
int numThreads = 1;
bool useTiles = false;
const char* widthString = NULL;
const char* heightString = NULL;
int gridWidth = 0;
int gridHeight = 0;
bool isPowerOf2Mode = false;
bool isCopyMode = false;
const char* xTilesString = NULL;
const char* yTilesString = NULL;
const char* mode = NULL;
bool gridSupported = false;
sk_tools::PictureRenderer::BBoxHierarchyType bbhType =
sk_tools::PictureRenderer::kNone_BBoxHierarchyType;
*validate = false;
*writeWholeImage = false;
*clones = 0;
SkISize viewport;
viewport.setEmpty();
SkScalar scaleFactor = SK_Scalar1;
for (++argv; argv < stop; ++argv) {
if (0 == strcmp(*argv, "--mode")) {
if (renderer != NULL) {
renderer->unref();
SkDebugf("Cannot combine modes.\n");
usage(argv0);
exit(-1);
}
++argv;
if (argv >= stop) {
SkDebugf("Missing mode for --mode\n");
usage(argv0);
exit(-1);
}
if (0 == strcmp(*argv, "simple")) {
renderer = SkNEW(sk_tools::SimplePictureRenderer);
} else if ((0 == strcmp(*argv, "tile")) || (0 == strcmp(*argv, "pow2tile"))
|| 0 == strcmp(*argv, "copyTile")) {
useTiles = true;
mode = *argv;
if (0 == strcmp(*argv, "pow2tile")) {
isPowerOf2Mode = true;
} else if (0 == strcmp(*argv, "copyTile")) {
isCopyMode = true;
} else {
gridSupported = true;
}
++argv;
if (argv >= stop) {
SkDebugf("Missing width for --mode %s\n", mode);
usage(argv0);
exit(-1);
}
widthString = *argv;
++argv;
if (argv >= stop) {
SkDebugf("Missing height for --mode %s\n", mode);
usage(argv0);
exit(-1);
}
heightString = *argv;
} else if (0 == strcmp(*argv, "rerecord")) {
renderer = SkNEW(sk_tools::RecordPictureRenderer);
} else {
SkDebugf("%s is not a valid mode for --mode\n", *argv);
usage(argv0);
exit(-1);
}
} else if (0 == strcmp(*argv, "--bbh")) {
++argv;
if (argv >= stop) {
SkDebugf("Missing value for --bbh\n");
usage(argv0);
exit(-1);
}
if (0 == strcmp(*argv, "none")) {
bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType;
} else if (0 == strcmp(*argv, "rtree")) {
bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType;
} else if (0 == strcmp(*argv, "grid")) {
bbhType = sk_tools::PictureRenderer::kTileGrid_BBoxHierarchyType;
++argv;
if (argv >= stop) {
//.........这里部分代码省略.........
示例2: parse_commandline
static void parse_commandline(int argc, char* const argv[], SkTArray<SkString>* inputs,
sk_tools::PictureBenchmark* benchmark) {
const char* argv0 = argv[0];
char* const* stop = argv + argc;
int repeats = DEFAULT_REPEATS;
sk_tools::PictureRenderer::SkDeviceTypes deviceType =
sk_tools::PictureRenderer::kBitmap_DeviceType;
SkAutoTUnref<sk_tools::PictureRenderer> renderer(NULL);
// Create a string to show our current settings.
// TODO: Make it prettier. Currently it just repeats the command line.
SkString commandLine("bench_pictures:");
for (int i = 1; i < argc; i++) {
commandLine.appendf(" %s", *(argv+i));
}
commandLine.append("\n");
bool usePipe = false;
int numThreads = 1;
bool useTiles = false;
const char* widthString = NULL;
const char* heightString = NULL;
int gridWidth = 0;
int gridHeight = 0;
bool isPowerOf2Mode = false;
bool isCopyMode = false;
const char* xTilesString = NULL;
const char* yTilesString = NULL;
const char* mode = NULL;
bool gridSupported = false;
sk_tools::PictureRenderer::BBoxHierarchyType bbhType =
sk_tools::PictureRenderer::kNone_BBoxHierarchyType;
sk_tools::PictureRenderer::DrawFilterFlags drawFilters[SkDrawFilter::kTypeCount];
sk_bzero(drawFilters, sizeof(drawFilters));
SkISize viewport;
viewport.setEmpty();
for (++argv; argv < stop; ++argv) {
if (0 == strcmp(*argv, "--repeat")) {
++argv;
if (argv < stop) {
repeats = atoi(*argv);
if (repeats < 1) {
gLogger.logError("--repeat must be given a value > 0\n");
PRINT_USAGE_AND_EXIT;
}
} else {
gLogger.logError("Missing arg for --repeat\n");
PRINT_USAGE_AND_EXIT;
}
} else if (0 == strcmp(*argv, "--pipe")) {
usePipe = true;
} else if (0 == strcmp(*argv, "--logFile")) {
argv++;
if (argv < stop) {
if (!gLogger.SetLogFile(*argv)) {
SkString str;
str.printf("Could not open %s for writing.", *argv);
gLogger.logError(str);
usage(argv0);
// TODO(borenet): We're disabling this for now, due to
// write-protected Android devices. The very short-term
// solution is to ignore the fact that we have no log file.
//exit(-1);
}
} else {
gLogger.logError("Missing arg for --logFile\n");
PRINT_USAGE_AND_EXIT;
}
} else if (0 == strcmp(*argv, "--multi")) {
++argv;
if (argv >= stop) {
gLogger.logError("Missing arg for --multi\n");
PRINT_USAGE_AND_EXIT;
}
numThreads = atoi(*argv);
if (numThreads < 2) {
gLogger.logError("Number of threads must be at least 2.\n");
PRINT_USAGE_AND_EXIT;
}
} else if (0 == strcmp(*argv, "--bbh")) {
++argv;
if (argv >= stop) {
gLogger.logError("Missing value for --bbh\n");
PRINT_USAGE_AND_EXIT;
}
if (0 == strcmp(*argv, "none")) {
bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType;
} else if (0 == strcmp(*argv, "rtree")) {
bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType;
} else if (0 == strcmp(*argv, "grid")) {
bbhType = sk_tools::PictureRenderer::kTileGrid_BBoxHierarchyType;
++argv;
if (argv >= stop) {
gLogger.logError("Missing width for --bbh grid\n");
PRINT_USAGE_AND_EXIT;
}
gridWidth = atoi(*argv);
++argv;
//.........这里部分代码省略.........