skia ID产生器
#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;
}