当前位置: 首页>>代码示例>>C++>>正文


C++ SkDeque::count方法代码示例

本文整理汇总了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);
    }
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例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();
    }
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:9,代码来源:GraphicsContextAndroid.cpp

示例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();
     }
 }
开发者ID:cmotc,项目名称:schs738c-external_webkit,代码行数:10,代码来源:GraphicsContextAndroid.cpp

示例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());
        }
    }
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例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);
}
开发者ID:,项目名称:,代码行数:39,代码来源:


注:本文中的SkDeque::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。