MCPcopy Create free account
hub / github.com/Samsung/rlottie / addCacheElement

Method addCacheElement

src/vector/vdrawhelper.cpp:104–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102protected:
103 uint maxCacheSize() const { return 60; }
104 VCacheData addCacheElement(VCacheKey hash_val, const VGradient &gradient)
105 {
106 if (mCache.size() == maxCacheSize()) {
107 uint count = maxCacheSize() / 10;
108 while (count--) {
109 mCache.erase(mCache.begin());
110 }
111 }
112 auto cache_entry = std::make_shared<CacheInfo>(gradient.mStops);
113 cache_entry->alpha = generateGradientColorTable(
114 gradient.mStops, gradient.alpha(), cache_entry->buffer32,
115 VGradient::colorTableSize);
116 mCache.insert(std::make_pair(hash_val, cache_entry));
117 return cache_entry;
118 }
119
120private:
121 VGradientCache() = default;

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
alphaMethod · 0.45

Tested by

no test coverage detected