diff options
| author | Romain Guy <romainguy@google.com> | 2010-06-30 15:51:03 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2010-06-30 15:51:03 -0700 |
| commit | 364703c6fa4aa1a7d2ef5b0c048ea2a0d57a4c40 (patch) | |
| tree | bb39ba42acd1d5e16c3120a89b1de216d65c0950 | |
| parent | 68e9a49aeb0b07d0d99c0a05771348bcd460a703 (diff) | |
| download | frameworks_base-364703c6fa4aa1a7d2ef5b0c048ea2a0d57a4c40.zip frameworks_base-364703c6fa4aa1a7d2ef5b0c048ea2a0d57a4c40.tar.gz frameworks_base-364703c6fa4aa1a7d2ef5b0c048ea2a0d57a4c40.tar.bz2 | |
Fix the build.
Change-Id: I08bd6daf25351daca3ae552e1cfcfce85eefa73b
| -rw-r--r-- | libs/hwui/GenerationCache.h | 8 | ||||
| -rw-r--r-- | libs/hwui/TextureCache.cpp | 9 | ||||
| -rw-r--r-- | libs/hwui/TextureCache.h | 2 |
3 files changed, 10 insertions, 9 deletions
diff --git a/libs/hwui/GenerationCache.h b/libs/hwui/GenerationCache.h index c4ff587..4a3ca77 100644 --- a/libs/hwui/GenerationCache.h +++ b/libs/hwui/GenerationCache.h @@ -41,9 +41,9 @@ public: void clear(); bool contains(K* key) const; - const V* get(K* key); + V* get(K* key); void put(K* key, V* value); - const V* remove(K* key); + V* remove(K* key); unsigned int size() const; @@ -108,7 +108,7 @@ bool GenerationCache<K, V>::contains(K* key) const { } 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); if (index >= 0) { sp<Entry<K*, V*> > entry = mCache.valueAt(index); @@ -148,7 +148,7 @@ void GenerationCache<K, V>::addToCache(sp<Entry<K*, V*> > entry, K* key, V* valu } 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); if (index >= 0) { sp<Entry<K*, V*> > entry = mCache.valueAt(index); diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp index b4a57ee..fd12a3c 100644 --- a/libs/hwui/TextureCache.cpp +++ b/libs/hwui/TextureCache.cpp @@ -40,7 +40,8 @@ void TextureCache::operator()(SkBitmap* key, Texture* value) { Texture* TextureCache::get(SkBitmap* bitmap) { Texture* texture = mCache.get(bitmap); if (!texture) { - texture = generateTexture(bitmap); + texture = new Texture; + generateTexture(bitmap, texture); mCache.put(bitmap, texture); } return texture; @@ -54,9 +55,7 @@ void TextureCache::clear() { mCache.clear(); } -Texture* TextureCache::generateTexture(SkBitmap* bitmap) { - Texture* texture = new Texture; - +void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture) { texture->width = bitmap->width(); texture->height = bitmap->height(); @@ -77,6 +76,8 @@ Texture* TextureCache::generateTexture(SkBitmap* bitmap) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap->getPixels()); break; + default: + break; } return texture; diff --git a/libs/hwui/TextureCache.h b/libs/hwui/TextureCache.h index 42328f4..7f95366 100644 --- a/libs/hwui/TextureCache.h +++ b/libs/hwui/TextureCache.h @@ -37,7 +37,7 @@ public: void clear(); private: - Texture* generateTexture(SkBitmap* bitmap); + void generateTexture(SkBitmap* bitmap, Texture* texture); GenerationCache<SkBitmap, Texture> mCache; }; // class TextureCache |
