本文整理汇总了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;
}
示例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();
}
示例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)
{}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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
}
示例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);
}
示例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;
}
示例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)];
}
示例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);
}
示例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);
}