本文整理汇总了C++中SkTArray::removeShuffle方法的典型用法代码示例。如果您正苦于以下问题:C++ SkTArray::removeShuffle方法的具体用法?C++ SkTArray::removeShuffle怎么用?C++ SkTArray::removeShuffle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkTArray
的用法示例。
在下文中一共展示了SkTArray::removeShuffle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestTSet_basic
static void TestTSet_basic(skiatest::Reporter* reporter) {
SkTArray<int, MEM_MOVE> a;
// Starts empty.
REPORTER_ASSERT(reporter, a.empty());
REPORTER_ASSERT(reporter, a.count() == 0);
// { }, add a default constructed element
a.push_back() = 0;
REPORTER_ASSERT(reporter, !a.empty());
REPORTER_ASSERT(reporter, a.count() == 1);
// { 0 }, removeShuffle the only element.
a.removeShuffle(0);
REPORTER_ASSERT(reporter, a.empty());
REPORTER_ASSERT(reporter, a.count() == 0);
// { }, add a default, add a 1, remove first
a.push_back() = 0;
REPORTER_ASSERT(reporter, a.push_back() = 1);
a.removeShuffle(0);
REPORTER_ASSERT(reporter, !a.empty());
REPORTER_ASSERT(reporter, a.count() == 1);
REPORTER_ASSERT(reporter, a[0] == 1);
// { 1 }, replace with new array
int b[5] = { 0, 1, 2, 3, 4 };
a.reset(b, SK_ARRAY_COUNT(b));
REPORTER_ASSERT(reporter, a.count() == SK_ARRAY_COUNT(b));
REPORTER_ASSERT(reporter, a[2] == 2);
REPORTER_ASSERT(reporter, a[4] == 4);
// { 0, 1, 2, 3, 4 }, removeShuffle the last
a.removeShuffle(4);
REPORTER_ASSERT(reporter, a.count() == SK_ARRAY_COUNT(b) - 1);
REPORTER_ASSERT(reporter, a[3] == 3);
// { 0, 1, 2, 3 }, remove a middle, note shuffle
a.removeShuffle(1);
REPORTER_ASSERT(reporter, a.count() == SK_ARRAY_COUNT(b) - 2);
REPORTER_ASSERT(reporter, a[0] == 0);
REPORTER_ASSERT(reporter, a[1] == 3);
REPORTER_ASSERT(reporter, a[2] == 2);
// {0, 3, 2 }
}
示例2: done
static void done(const char* config, const char* src, const char* srcOptions, const char* name) {
SkString id = SkStringPrintf("%s %s %s %s", config, src, srcOptions, name);
vlog("done %s\n", id.c_str());
int pending;
{
SkAutoMutexAcquire lock(gMutex);
for (int i = 0; i < gRunning.count(); i++) {
if (gRunning[i] == id) {
gRunning.removeShuffle(i);
break;
}
}
pending = --gPending;
}
// We write our dm.json file every once in a while in case we crash.
// Notice this also handles the final dm.json when pending == 0.
if (pending % 500 == 0) {
JsonWriter::DumpJson();
}
}
示例3: done
static void done(double ms,
ImplicitString config, ImplicitString src, ImplicitString srcOptions,
ImplicitString name, ImplicitString note, ImplicitString log) {
SkString id = SkStringPrintf("%s %s %s %s", config.c_str(), src.c_str(),
srcOptions.c_str(), name.c_str());
{
SkAutoMutexAcquire lock(gRunningAndTallyMutex);
for (int i = 0; i < gRunning.count(); i++) {
if (gRunning[i] == id) {
gRunning.removeShuffle(i);
break;
}
}
if (!note.isEmpty()) {
if (int* tally = gNoteTally.find(note)) {
*tally += 1;
} else {
gNoteTally.set(note, 1);
}
}
}
if (!log.isEmpty()) {
log.prepend("\n");
}
auto pending = sk_atomic_dec(&gPending)-1;
if (!FLAGS_quiet && note.isEmpty()) {
SkDebugf("%s(%4d/%-4dMB %6d) %s\t%s%s", FLAGS_verbose ? "\n" : kSkOverwriteLine
, sk_tools::getCurrResidentSetSizeMB()
, sk_tools::getMaxResidentSetSizeMB()
, pending
, HumanizeMs(ms).c_str()
, id.c_str()
, log.c_str());
}
// We write our dm.json file every once in a while in case we crash.
// Notice this also handles the final dm.json when pending == 0.
if (pending % 500 == 0) {
JsonWriter::DumpJson();
}
}