#include "include/core/SkTypes.h"
class SkNextID {
public:
/**
* Shared between SkPixelRef's generationID and SkImage's uniqueID
*/
static uint32_t ImageID();
};
/////////////////////////////////////////////////////////////////
#include <atomic>
uint32_t SkNextID::ImageID() {
// We never set the low bit.... see SkPixelRef::genIDIsUnique().
static std::atomic<uint32_t> nextID{2};
uint32_t id;
do {
id = nextID.fetch_add(2, std::memory_order_relaxed);
} while (id == 0);
return id;
}
标签:id,ImageID,static,产生器,skia,ID,include,uint32 From: https://www.cnblogs.com/bigben0123/p/17148825.html