本文整理汇总了C++中SkTDArray::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ SkTDArray::remove方法的具体用法?C++ SkTDArray::remove怎么用?C++ SkTDArray::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkTDArray
的用法示例。
在下文中一共展示了SkTDArray::remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unalloc
void FlattenableHeap::unalloc(void* ptr) {
int indexToRemove = fPointers.rfind(ptr);
if (indexToRemove >= 0) {
sk_free(ptr);
fPointers.remove(indexToRemove);
}
}
示例2: remove
void ActiveTrapezoids::remove(Trapezoid *t) {
DebugPrintf("Removing a trapezoid...");
for (Trapezoid **tp = fTrapezoids.begin(); tp < fTrapezoids.end(); ++tp) {
if (*tp == t) {
fTrapezoids.remove(tp - fTrapezoids.begin());
DebugPrintf(" done.\n");
return;
}
}
DebugPrintf(" Arghh! Panic!\n");
SkASSERT(t == 0); // Cannot find t in active trapezoid list.
}
示例3: Parse
void SkCommandLineFlags::Parse(int argc, char** argv) {
// Only allow calling this function once.
static bool gOnce;
if (gOnce) {
SkDebugf("Parse should only be called once at the beginning of main!\n");
SkASSERT(false);
return;
}
gOnce = true;
bool helpPrinted = false;
// Loop over argv, starting with 1, since the first is just the name of the program.
for (int i = 1; i < argc; i++) {
if (0 == strcmp("-h", argv[i]) || 0 == strcmp("--help", argv[i])) {
// Print help message.
SkTDArray<const char*> helpFlags;
for (int j = i + 1; j < argc; j++) {
if (SkStrStartsWith(argv[j], '-')) {
break;
}
helpFlags.append(1, &argv[j]);
}
if (0 == helpFlags.count()) {
// Only print general help message if help for specific flags is not requested.
SkDebugf("%s\n%s\n", argv[0], gUsage.c_str());
}
SkDebugf("Flags:\n");
SkFlagInfo* flag = SkCommandLineFlags::gHead;
while (flag != NULL) {
// If no flags followed --help, print them all
bool printFlag = 0 == helpFlags.count();
if (!printFlag) {
for (int k = 0; k < helpFlags.count(); k++) {
if (flag->name().equals(helpFlags[k]) ||
flag->shortName().equals(helpFlags[k])) {
printFlag = true;
helpFlags.remove(k);
break;
}
}
}
if (printFlag) {
print_help_for_flag(flag);
}
flag = flag->next();
}
if (helpFlags.count() > 0) {
SkDebugf("Requested help for unrecognized flags:\n");
for (int k = 0; k < helpFlags.count(); k++) {
SkDebugf("\t--%s\n", helpFlags[k]);
}
}
helpPrinted = true;
}
if (!helpPrinted) {
bool flagMatched = false;
SkFlagInfo* flag = gHead;
while (flag != NULL) {
if (flag->match(argv[i])) {
flagMatched = true;
switch (flag->getFlagType()) {
case SkFlagInfo::kBool_FlagType:
// Can be handled by match, above, but can also be set by the next
// string.
if (i+1 < argc && !SkStrStartsWith(argv[i+1], '-')) {
i++;
bool value;
if (parse_bool_arg(argv[i], &value)) {
flag->setBool(value);
}
}
break;
case SkFlagInfo::kString_FlagType:
flag->resetStrings();
// Add all arguments until another flag is reached.
while (i+1 < argc && !SkStrStartsWith(argv[i+1], '-')) {
i++;
flag->append(argv[i]);
}
break;
case SkFlagInfo::kInt_FlagType:
i++;
flag->setInt(atoi(argv[i]));
break;
case SkFlagInfo::kDouble_FlagType:
i++;
flag->setDouble(atof(argv[i]));
break;
default:
SkASSERT(!"Invalid flag type");
}
break;
}
flag = flag->next();
}
if (!flagMatched) {
SkDebugf("Got unknown flag \"%s\". Exiting.\n", argv[i]);
exit(-1);
}
}
//.........这里部分代码省略.........
示例4: tool_main
int tool_main(int argc, char** argv) {
SetupCrashHandler();
SkCommandLineFlags::Parse(argc, argv);
#if SK_ENABLE_INST_COUNT
if (FLAGS_leaks) {
gPrintInstCount = true;
}
#endif
SkAutoGraphics ag;
// First, parse some flags.
BenchLogger logger;
if (FLAGS_logFile.count()) {
logger.SetLogFile(FLAGS_logFile[0]);
}
LoggerResultsWriter logWriter(logger, FLAGS_timeFormat[0]);
MultiResultsWriter writer;
writer.add(&logWriter);
SkAutoTDelete<JSONResultsWriter> jsonWriter;
if (FLAGS_outResultsFile.count()) {
jsonWriter.reset(SkNEW(JSONResultsWriter(FLAGS_outResultsFile[0])));
writer.add(jsonWriter.get());
}
// Instantiate after all the writers have been added to writer so that we
// call close() before their destructors are called on the way out.
CallEnd<MultiResultsWriter> ender(writer);
const uint8_t alpha = FLAGS_forceBlend ? 0x80 : 0xFF;
SkTriState::State dither = SkTriState::kDefault;
for (size_t i = 0; i < 3; i++) {
if (strcmp(SkTriState::Name[i], FLAGS_forceDither[0]) == 0) {
dither = static_cast<SkTriState::State>(i);
}
}
BenchMode benchMode = kNormal_BenchMode;
for (size_t i = 0; i < SK_ARRAY_COUNT(BenchMode_Name); i++) {
if (strcmp(FLAGS_mode[0], BenchMode_Name[i]) == 0) {
benchMode = static_cast<BenchMode>(i);
}
}
SkTDArray<int> configs;
bool runDefaultConfigs = false;
// Try user-given configs first.
for (int i = 0; i < FLAGS_config.count(); i++) {
for (int j = 0; j < static_cast<int>(SK_ARRAY_COUNT(gConfigs)); ++j) {
if (0 == strcmp(FLAGS_config[i], gConfigs[j].name)) {
*configs.append() = j;
} else if (0 == strcmp(FLAGS_config[i], kDefaultsConfigStr)) {
runDefaultConfigs = true;
}
}
}
// If there weren't any, fill in with defaults.
if (runDefaultConfigs) {
for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(gConfigs)); ++i) {
if (gConfigs[i].runByDefault) {
*configs.append() = i;
}
}
}
// Filter out things we can't run.
if (kNormal_BenchMode != benchMode) {
// Non-rendering configs only run in normal mode
for (int i = 0; i < configs.count(); ++i) {
const Config& config = gConfigs[configs[i]];
if (Benchmark::kNonRendering_Backend == config.backend) {
configs.remove(i, 1);
--i;
}
}
}
#if SK_SUPPORT_GPU
for (int i = 0; i < configs.count(); ++i) {
const Config& config = gConfigs[configs[i]];
if (Benchmark::kGPU_Backend == config.backend) {
GrContext* context = gContextFactory.get(config.contextType);
if (NULL == context) {
SkDebugf("GrContext could not be created for config %s. Config will be skipped.\n",
config.name);
configs.remove(i);
--i;
continue;
}
if (config.sampleCount > context->getMaxSampleCount()){
SkDebugf(
"Sample count (%d) for config %s is not supported. Config will be skipped.\n",
config.sampleCount, config.name);
configs.remove(i);
--i;
continue;
}
}
}
//.........这里部分代码省略.........
示例5: Parse
void SkCommandLineFlags::Parse(int argc, char** argv) {
// Only allow calling this function once.
static bool gOnce;
if (gOnce) {
SkDebugf("Parse should only be called once at the beginning of main!\n");
SkASSERT(false);
return;
}
gOnce = true;
bool helpPrinted = false;
// Loop over argv, starting with 1, since the first is just the name of the program.
for (int i = 1; i < argc; i++) {
if (0 == strcmp("-h", argv[i]) || 0 == strcmp("--help", argv[i])) {
// Print help message.
SkTDArray<const char*> helpFlags;
for (int j = i + 1; j < argc; j++) {
if (SkStrStartsWith(argv[j], '-')) {
break;
}
helpFlags.append(1, &argv[j]);
}
if (0 == helpFlags.count()) {
// Only print general help message if help for specific flags is not requested.
SkDebugf("%s\n%s\n", argv[0], gUsage.c_str());
}
SkDebugf("Flags:\n");
if (0 == helpFlags.count()) {
// If no flags followed --help, print them all
SkTDArray<SkFlagInfo*> allFlags;
for (SkFlagInfo* flag = SkCommandLineFlags::gHead; flag;
flag = flag->next()) {
allFlags.push(flag);
}
SkTQSort(&allFlags[0], &allFlags[allFlags.count() - 1],
CompareFlagsByName());
for (int i = 0; i < allFlags.count(); ++i) {
print_help_for_flag(allFlags[i]);
if (allFlags[i]->extendedHelp().size() > 0) {
SkDebugf(" Use '--help %s' for more information.\n",
allFlags[i]->name().c_str());
}
}
} else {
for (SkFlagInfo* flag = SkCommandLineFlags::gHead; flag;
flag = flag->next()) {
for (int k = 0; k < helpFlags.count(); k++) {
if (flag->name().equals(helpFlags[k]) ||
flag->shortName().equals(helpFlags[k])) {
print_extended_help_for_flag(flag);
helpFlags.remove(k);
break;
}
}
}
}
if (helpFlags.count() > 0) {
SkDebugf("Requested help for unrecognized flags:\n");
for (int k = 0; k < helpFlags.count(); k++) {
SkDebugf(" --%s\n", helpFlags[k]);
}
}
helpPrinted = true;
}
if (!helpPrinted) {
bool flagMatched = false;
SkFlagInfo* flag = gHead;
while (flag != nullptr) {
if (flag->match(argv[i])) {
flagMatched = true;
switch (flag->getFlagType()) {
case SkFlagInfo::kBool_FlagType:
// Can be handled by match, above, but can also be set by the next
// string.
if (i+1 < argc && !SkStrStartsWith(argv[i+1], '-')) {
i++;
bool value;
if (parse_bool_arg(argv[i], &value)) {
flag->setBool(value);
}
}
break;
case SkFlagInfo::kString_FlagType:
flag->resetStrings();
// Add all arguments until another flag is reached.
while (i+1 < argc) {
char* end = nullptr;
// Negative numbers aren't flags.
ignore_result(strtod(argv[i+1], &end));
if (end == argv[i+1] && SkStrStartsWith(argv[i+1], '-')) {
break;
}
i++;
flag->append(argv[i]);
}
break;
case SkFlagInfo::kInt_FlagType:
i++;
flag->setInt(atoi(argv[i]));
//.........这里部分代码省略.........