本文整理汇总了C++中SkDeque::count方法的典型用法代码示例。如果您正苦于以下问题:C++ SkDeque::count方法的具体用法?C++ SkDeque::count怎么用?C++ SkDeque::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkDeque
的用法示例。
在下文中一共展示了SkDeque::count方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert_blocks
static void assert_blocks(skiatest::Reporter* reporter,
const SkDeque& deq,
int allocCount) {
DequeUnitTestHelper helper(deq);
if (0 == deq.count()) {
REPORTER_ASSERT(reporter, 1 == helper.fNumBlocksAllocated);
} else {
int expected = (deq.count() + allocCount - 1) / allocCount;
// A block isn't freed in the deque when it first becomes empty so
// sometimes an extra block lingers around
REPORTER_ASSERT(reporter,
expected == helper.fNumBlocksAllocated ||
expected+1 == helper.fNumBlocksAllocated);
}
}
示例2: while
~GraphicsContextPlatformPrivate() {
if (mPgc && mPgc->deleteUs())
delete mPgc;
// we force restores so we don't leak any subobjects owned by our
// stack of State records.
while (mStateStack.count() > 0)
this->restore();
}
示例3: setStateStack
void setStateStack(SkDeque& stateStack)
{
while (stateStack.count() > 0)
{
State* copyState = static_cast<State*>(stateStack.back());
State* newState = static_cast<State*>(m_stateStack.push_back());
new (newState) State(*copyState);
stateStack.pop_back();
}
}
示例4: assert_count
static void assert_count(skiatest::Reporter* reporter, const SkDeque& deq, int count) {
if (0 == count) {
REPORTER_ASSERT(reporter, deq.empty());
REPORTER_ASSERT(reporter, 0 == deq.count());
REPORTER_ASSERT(reporter, sizeof(int) == deq.elemSize());
REPORTER_ASSERT(reporter, nullptr == deq.front());
REPORTER_ASSERT(reporter, nullptr == deq.back());
} else {
REPORTER_ASSERT(reporter, !deq.empty());
REPORTER_ASSERT(reporter, count == deq.count());
REPORTER_ASSERT(reporter, sizeof(int) == deq.elemSize());
REPORTER_ASSERT(reporter, deq.front());
REPORTER_ASSERT(reporter, deq.back());
if (1 == count) {
REPORTER_ASSERT(reporter, deq.back() == deq.front());
} else {
REPORTER_ASSERT(reporter, deq.back() != deq.front());
}
}
}
示例5: assert_iter
static void assert_iter(skiatest::Reporter* reporter, const SkDeque& deq,
int max, int min) {
// test forward iteration
SkDeque::Iter iter(deq, SkDeque::Iter::kFront_IterStart);
void* ptr;
int value = max;
while ((ptr = iter.next())) {
REPORTER_ASSERT(reporter, value == *(int*)ptr);
value -= 1;
}
REPORTER_ASSERT(reporter, value+1 == min);
// test reverse iteration
iter.reset(deq, SkDeque::Iter::kBack_IterStart);
value = min;
while ((ptr = iter.prev())) {
REPORTER_ASSERT(reporter, value == *(int*)ptr);
value += 1;
}
REPORTER_ASSERT(reporter, value-1 == max);
// test mixed iteration
iter.reset(deq, SkDeque::Iter::kFront_IterStart);
value = max;
// forward iteration half-way
for (int i = 0; i < deq.count()/2 && (ptr = iter.next()); i++) {
REPORTER_ASSERT(reporter, value == *(int*)ptr);
value -= 1;
}
// then back down w/ reverse iteration
while ((ptr = iter.prev())) {
REPORTER_ASSERT(reporter, value == *(int*)ptr);
value += 1;
}
REPORTER_ASSERT(reporter, value-1 == max);
}