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


C++ sk_atomic_inc函数代码示例

本文整理汇总了C++中sk_atomic_inc函数的典型用法代码示例。如果您正苦于以下问题:C++ sk_atomic_inc函数的具体用法?C++ sk_atomic_inc怎么用?C++ sk_atomic_inc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sk_atomic_inc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: next_id

static int32_t next_id() {
    int32_t id;
    do {
        id = sk_atomic_inc(&gNextID);
    } while (id == SK_InvalidGenID);
    return id;
}
开发者ID:sheuan,项目名称:skia,代码行数:7,代码来源:GrContext.cpp

示例2: globalRef

void AndroidPixelRef::globalRef(void* localref) {
    if (fWrappedPixelRef) {
        // delegate java obj management to the wrapped ref
        fWrappedPixelRef->globalRef(localref);

        // Note: we only ref and unref the wrapped AndroidPixelRef so that
        // bitmap->pixelRef()->globalRef() and globalUnref() can be used in a pair, even if
        // the bitmap has its underlying AndroidPixelRef swapped out/wrapped
        return;
    }
    if (fOnJavaHeap && sk_atomic_inc(&fGlobalRefCnt) == 0) {
        JNIEnv *env = vm2env(fVM);

        // If JNI ref was passed, it is always used
        if (localref) fStorageObj = (jbyteArray) localref;

        if (fStorageObj == NULL) {
            SkDebugf("No valid local ref to create a JNI global ref\n");
            sk_throw();
        }
        if (fHasGlobalRef) {
            // This should never happen
            SkDebugf("Already holding a JNI global ref");
            sk_throw();
        }

        fStorageObj = (jbyteArray) env->NewGlobalRef(fStorageObj);
        // TODO: Check for failure here
        fHasGlobalRef = true;
    }
    ref();
}
开发者ID:lovelifer,项目名称:graduate,代码行数:32,代码来源:Graphics.cpp

示例3: fColorLUT

SkColorSpace::SkColorSpace(SkColorLookUpTable* colorLUT, sk_sp<SkGammas> gammas,
                           const SkMatrix44& toXYZD50)
    : fColorLUT(colorLUT)
    , fGammas(gammas)
    , fToXYZD50(toXYZD50)
    , fUniqueID(sk_atomic_inc(&gUniqueColorSpaceID))
    , fNamed(kUnknown_Named)
{}
开发者ID:C-Tillion,项目名称:skia,代码行数:8,代码来源:SkColorSpace.cpp

示例4: CreateUniqueID

uint32_t GrProgramElement::CreateUniqueID() {
    static int32_t gUniqueID = SK_InvalidUniqueID;
    uint32_t id;
    do {
        id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
    } while (id == SK_InvalidUniqueID);
    return id;
}
开发者ID:DXGL,项目名称:skia,代码行数:8,代码来源:GrProgramElement.cpp

示例5: CreateUniqueID

uint32_t GrDrawTargetCaps::CreateUniqueID() {
    static int32_t gUniqueID = SK_InvalidUniqueID;
    uint32_t id;
    do {
        id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
    } while (id == SK_InvalidUniqueID);
    return id;
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:8,代码来源:GrDrawTarget.cpp

示例6: sk_atomic_inc

SkOSMenu::Item::Item(const char label[], SkOSMenu::Type type,
                     const char slotName[], SkEvent* evt) {
    fLabel.set(label);
    fSlotName.set(slotName);
    fType = type;
    fEvent = evt;
    fKey = 0;
    fID = sk_atomic_inc(&gOSMenuCmd);
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:9,代码来源:SkOSMenu.cpp

示例7: next_image_filter_unique_id

static int32_t next_image_filter_unique_id() {
    static int32_t gImageFilterUniqueID;

    // Never return 0.
    int32_t id;
    do {
        id = sk_atomic_inc(&gImageFilterUniqueID) + 1;
    } while (0 == id);
    return id;
}
开发者ID:Dnnono,项目名称:skia,代码行数:10,代码来源:SkImageFilter.cpp

示例8: sk_atomic_inc

SkPicture::AccelData::Domain SkPicture::AccelData::GenerateDomain() {
    static int32_t gNextID = 0;

    int32_t id = sk_atomic_inc(&gNextID);
    if (id >= 1 << (8 * sizeof(Domain))) {
        SK_CRASH();
    }

    return static_cast<Domain>(id);
}
开发者ID:UIKit0,项目名称:skia,代码行数:10,代码来源:SkPicture.cpp

示例9: sk_atomic_inc

GrCacheID::Domain GrCacheID::GenerateDomain() {
    static int32_t gNextDomain = kInvalid_Domain + 1;

    int32_t domain = sk_atomic_inc(&gNextDomain);
    if (domain >= 1 << (8 * sizeof(Domain))) {
        GrCrash("Too many Cache Domains");
    }

    return static_cast<Domain>(domain);
}
开发者ID:CodeSpeaker,项目名称:gecko-dev,代码行数:10,代码来源:GrCacheID.cpp

示例10: get_default_mutex

SkBaseMutex* get_default_mutex() {
#ifdef PIXELREF_MUTEX_RING_COUNT
    // atomic_inc might be overkill here. It may be fine if once in a while
    // we hit a race-condition and two subsequent calls get the same index...
    int index = sk_atomic_inc(&gPixelRefMutexRingIndex);
    return &gPixelRefMutexRing[index & (PIXELREF_MUTEX_RING_COUNT - 1)];
#else
    return &gPixelRefMutex;
#endif
}
开发者ID:jrmuizel,项目名称:image-scaling,代码行数:10,代码来源:SkPixelRef.cpp

示例11: sk_atomic_inc

GrResourceKey::ResourceType GrResourceKey::GenerateResourceType() {
    static int32_t gNextType = 0;

    int32_t type = sk_atomic_inc(&gNextType);
    if (type >= (1 << 8 * sizeof(ResourceType))) {
        SkFAIL("Too many Resource Types");
    }

    return static_cast<ResourceType>(type);
}
开发者ID:iHaD,项目名称:skia,代码行数:10,代码来源:GrResourceCache.cpp

示例12: sk_atomic_inc

uint32_t SkImage::NextUniqueID() {
    static int32_t gUniqueID;

    // never return 0;
    uint32_t id;
    do {
        id = sk_atomic_inc(&gUniqueID) + 1;
    } while (0 == id);
    return id;
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:10,代码来源:SkImage.cpp

示例13: get_default_mutex

static SkBaseMutex* get_default_mutex() {
    static int32_t gPixelRefMutexRingIndex;

    SkASSERT(SkIsPow2(PIXELREF_MUTEX_RING_COUNT));

    // atomic_inc might be overkill here. It may be fine if once in a while
    // we hit a race-condition and two subsequent calls get the same index...
    int index = sk_atomic_inc(&gPixelRefMutexRingIndex);
    return &gPixelRefMutexRing[index & (PIXELREF_MUTEX_RING_COUNT - 1)];
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:10,代码来源:SkPixelRef.cpp

示例14: sk_atomic_inc

GrScratchKey::ResourceType GrScratchKey::GenerateResourceType() {
    static int32_t gType = INHERITED::kInvalidDomain + 1;

    int32_t type = sk_atomic_inc(&gType);
    if (type > SK_MaxU16) {
        SkFAIL("Too many Resource Types");
    }

    return static_cast<ResourceType>(type);
}
开发者ID:jszwedko,项目名称:skia,代码行数:10,代码来源:GrResourceCache.cpp

示例15: sk_atomic_inc

GrScratchKey::ResourceType GrScratchKey::GenerateResourceType() {
    static int32_t gType = INHERITED::kInvalidDomain + 1;

    int32_t type = sk_atomic_inc(&gType);
    if (type > SkTo<int32_t>(UINT16_MAX)) {
        SK_ABORT("Too many Resource Types");
    }

    return static_cast<ResourceType>(type);
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:10,代码来源:GrResourceCache.cpp


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