Loading libs/hwui/GenerationCache.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -41,9 +41,9 @@ public: void clear(); void clear(); bool contains(K* key) const; bool contains(K* key) const; const V* get(K* key); V* get(K* key); void put(K* key, V* value); void put(K* key, V* value); const V* remove(K* key); V* remove(K* key); unsigned int size() const; unsigned int size() const; Loading Loading @@ -108,7 +108,7 @@ bool GenerationCache<K, V>::contains(K* key) const { } } template<typename K, typename V> template<typename K, typename V> const V* GenerationCache<K, V>::get(K* key) { V* GenerationCache<K, V>::get(K* key) { ssize_t index = mCache.indexOfKey(key); ssize_t index = mCache.indexOfKey(key); if (index >= 0) { if (index >= 0) { sp<Entry<K*, V*> > entry = mCache.valueAt(index); sp<Entry<K*, V*> > entry = mCache.valueAt(index); Loading Loading @@ -148,7 +148,7 @@ void GenerationCache<K, V>::addToCache(sp<Entry<K*, V*> > entry, K* key, V* valu } } template<typename K, typename V> template<typename K, typename V> const V* GenerationCache<K, V>::remove(K* key) { V* GenerationCache<K, V>::remove(K* key) { ssize_t index = mCache.indexOfKey(key); ssize_t index = mCache.indexOfKey(key); if (index >= 0) { if (index >= 0) { sp<Entry<K*, V*> > entry = mCache.valueAt(index); sp<Entry<K*, V*> > entry = mCache.valueAt(index); Loading libs/hwui/TextureCache.cpp +5 −4 Original line number Original line Diff line number Diff line Loading @@ -40,7 +40,8 @@ void TextureCache::operator()(SkBitmap* key, Texture* value) { Texture* TextureCache::get(SkBitmap* bitmap) { Texture* TextureCache::get(SkBitmap* bitmap) { Texture* texture = mCache.get(bitmap); Texture* texture = mCache.get(bitmap); if (!texture) { if (!texture) { texture = generateTexture(bitmap); texture = new Texture; generateTexture(bitmap, texture); mCache.put(bitmap, texture); mCache.put(bitmap, texture); } } return texture; return texture; Loading @@ -54,9 +55,7 @@ void TextureCache::clear() { mCache.clear(); mCache.clear(); } } Texture* TextureCache::generateTexture(SkBitmap* bitmap) { void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture) { Texture* texture = new Texture; texture->width = bitmap->width(); texture->width = bitmap->width(); texture->height = bitmap->height(); texture->height = bitmap->height(); Loading @@ -77,6 +76,8 @@ Texture* TextureCache::generateTexture(SkBitmap* bitmap) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap->getPixels()); 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap->getPixels()); break; break; default: break; } } return texture; return texture; Loading libs/hwui/TextureCache.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -37,7 +37,7 @@ public: void clear(); void clear(); private: private: Texture* generateTexture(SkBitmap* bitmap); void generateTexture(SkBitmap* bitmap, Texture* texture); GenerationCache<SkBitmap, Texture> mCache; GenerationCache<SkBitmap, Texture> mCache; }; // class TextureCache }; // class TextureCache Loading Loading
libs/hwui/GenerationCache.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -41,9 +41,9 @@ public: void clear(); void clear(); bool contains(K* key) const; bool contains(K* key) const; const V* get(K* key); V* get(K* key); void put(K* key, V* value); void put(K* key, V* value); const V* remove(K* key); V* remove(K* key); unsigned int size() const; unsigned int size() const; Loading Loading @@ -108,7 +108,7 @@ bool GenerationCache<K, V>::contains(K* key) const { } } template<typename K, typename V> template<typename K, typename V> const V* GenerationCache<K, V>::get(K* key) { V* GenerationCache<K, V>::get(K* key) { ssize_t index = mCache.indexOfKey(key); ssize_t index = mCache.indexOfKey(key); if (index >= 0) { if (index >= 0) { sp<Entry<K*, V*> > entry = mCache.valueAt(index); sp<Entry<K*, V*> > entry = mCache.valueAt(index); Loading Loading @@ -148,7 +148,7 @@ void GenerationCache<K, V>::addToCache(sp<Entry<K*, V*> > entry, K* key, V* valu } } template<typename K, typename V> template<typename K, typename V> const V* GenerationCache<K, V>::remove(K* key) { V* GenerationCache<K, V>::remove(K* key) { ssize_t index = mCache.indexOfKey(key); ssize_t index = mCache.indexOfKey(key); if (index >= 0) { if (index >= 0) { sp<Entry<K*, V*> > entry = mCache.valueAt(index); sp<Entry<K*, V*> > entry = mCache.valueAt(index); Loading
libs/hwui/TextureCache.cpp +5 −4 Original line number Original line Diff line number Diff line Loading @@ -40,7 +40,8 @@ void TextureCache::operator()(SkBitmap* key, Texture* value) { Texture* TextureCache::get(SkBitmap* bitmap) { Texture* TextureCache::get(SkBitmap* bitmap) { Texture* texture = mCache.get(bitmap); Texture* texture = mCache.get(bitmap); if (!texture) { if (!texture) { texture = generateTexture(bitmap); texture = new Texture; generateTexture(bitmap, texture); mCache.put(bitmap, texture); mCache.put(bitmap, texture); } } return texture; return texture; Loading @@ -54,9 +55,7 @@ void TextureCache::clear() { mCache.clear(); mCache.clear(); } } Texture* TextureCache::generateTexture(SkBitmap* bitmap) { void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture) { Texture* texture = new Texture; texture->width = bitmap->width(); texture->width = bitmap->width(); texture->height = bitmap->height(); texture->height = bitmap->height(); Loading @@ -77,6 +76,8 @@ Texture* TextureCache::generateTexture(SkBitmap* bitmap) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap->getPixels()); 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap->getPixels()); break; break; default: break; } } return texture; return texture; Loading
libs/hwui/TextureCache.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -37,7 +37,7 @@ public: void clear(); void clear(); private: private: Texture* generateTexture(SkBitmap* bitmap); void generateTexture(SkBitmap* bitmap, Texture* texture); GenerationCache<SkBitmap, Texture> mCache; GenerationCache<SkBitmap, Texture> mCache; }; // class TextureCache }; // class TextureCache Loading