本文整理汇总了C++中SkAutoTUnref::setTileWidthPercentage方法的典型用法代码示例。如果您正苦于以下问题:C++ SkAutoTUnref::setTileWidthPercentage方法的具体用法?C++ SkAutoTUnref::setTileWidthPercentage怎么用?C++ SkAutoTUnref::setTileWidthPercentage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkAutoTUnref
的用法示例。
在下文中一共展示了SkAutoTUnref::setTileWidthPercentage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseRenderer
//.........这里部分代码省略.........
int x, y;
if (xTiles != -1 && yTiles != -1) {
x = xTiles;
y = yTiles;
if (x <= 0 || y <= 0) {
error.printf("--tiles must be given values > 0\n");
return NULL;
}
} else {
x = y = 4;
}
tiledRenderer.reset(SkNEW_ARGS(sk_tools::CopyTilesRenderer, (x, y)));
} else if (FLAGS_multi > 1) {
tiledRenderer.reset(SkNEW_ARGS(sk_tools::MultiCorePictureRenderer,
(FLAGS_multi)));
} else {
tiledRenderer.reset(SkNEW(sk_tools::TiledPictureRenderer));
}
if (isPowerOf2Mode) {
int minWidth = atoi(widthString);
if (!SkIsPow2(minWidth) || minWidth < 0) {
SkString err;
error.printf("-mode %s must be given a width"
" value that is a power of two\n", mode);
return NULL;
}
tiledRenderer->setTileMinPowerOf2Width(minWidth);
} else if (sk_tools::is_percentage(widthString)) {
if (isCopyMode) {
error.printf("--mode %s does not support percentages.\n", mode);
return NULL;
}
tiledRenderer->setTileWidthPercentage(atof(widthString));
if (!(tiledRenderer->getTileWidthPercentage() > 0)) {
error.printf("--mode %s must be given a width percentage > 0\n", mode);
return NULL;
}
} else {
tiledRenderer->setTileWidth(atoi(widthString));
if (!(tiledRenderer->getTileWidth() > 0)) {
error.printf("--mode %s must be given a width > 0\n", mode);
return NULL;
}
}
if (sk_tools::is_percentage(heightString)) {
if (isCopyMode) {
error.printf("--mode %s does not support percentages.\n", mode);
return NULL;
}
tiledRenderer->setTileHeightPercentage(atof(heightString));
if (!(tiledRenderer->getTileHeightPercentage() > 0)) {
error.printf("--mode %s must be given a height percentage > 0\n", mode);
return NULL;
}
} else {
tiledRenderer->setTileHeight(atoi(heightString));
if (!(tiledRenderer->getTileHeight() > 0)) {
SkString err;
error.printf("--mode %s must be given a height > 0\n", mode);
return NULL;
}
}
renderer.reset(tiledRenderer.detach());
示例2: parseRenderer
//.........这里部分代码省略.........
if (xTiles != -1 && yTiles != -1) {
x = xTiles;
y = yTiles;
if (x <= 0 || y <= 0) {
error.printf("--tiles must be given values > 0\n");
return NULL;
}
} else {
x = y = 4;
}
#if SK_SUPPORT_GPU
tiledRenderer.reset(SkNEW_ARGS(sk_tools::CopyTilesRenderer, (grContextOpts, x, y)));
#else
tiledRenderer.reset(SkNEW_ARGS(sk_tools::CopyTilesRenderer, (x, y)));
#endif
} else {
tiledRenderer.reset(SkNEW_ARGS(sk_tools::TiledPictureRenderer, RENDERER_ARGS));
}
if (isPowerOf2Mode) {
int minWidth = atoi(widthString);
if (!SkIsPow2(minWidth) || minWidth < 0) {
SkString err;
error.printf("-mode %s must be given a width"
" value that is a power of two\n", mode);
return NULL;
}
tiledRenderer->setTileMinPowerOf2Width(minWidth);
} else if (sk_tools::is_percentage(widthString)) {
if (isCopyMode) {
error.printf("--mode %s does not support percentages.\n", mode);
return NULL;
}
tiledRenderer->setTileWidthPercentage(atof(widthString));
if (!(tiledRenderer->getTileWidthPercentage() > 0)) {
error.printf("--mode %s must be given a width percentage > 0\n", mode);
return NULL;
}
} else {
tiledRenderer->setTileWidth(atoi(widthString));
if (!(tiledRenderer->getTileWidth() > 0)) {
error.printf("--mode %s must be given a width > 0\n", mode);
return NULL;
}
}
if (sk_tools::is_percentage(heightString)) {
if (isCopyMode) {
error.printf("--mode %s does not support percentages.\n", mode);
return NULL;
}
tiledRenderer->setTileHeightPercentage(atof(heightString));
if (!(tiledRenderer->getTileHeightPercentage() > 0)) {
error.printf("--mode %s must be given a height percentage > 0\n", mode);
return NULL;
}
} else {
tiledRenderer->setTileHeight(atoi(heightString));
if (!(tiledRenderer->getTileHeight() > 0)) {
SkString err;
error.printf("--mode %s must be given a height > 0\n", mode);
return NULL;
}
}
renderer.reset(tiledRenderer.detach());