diff options
author | 2013-01-03 14:22:40 -0800 | |
---|---|---|
committer | 2013-01-03 14:45:39 -0800 | |
commit | 15a65bfee5b0a98664eb5ebadad63c73e2c471f8 (patch) | |
tree | 3fe682fcf0893d426e60da1847465d9009ef7f31 /libs/hwui/GradientCache.cpp | |
parent | dcfc836b457a87881da409e1acf251515f121446 (diff) |
Remove unnecessary & uninitialized variable
Bug #7728929
The uninitialized variable was taken into account to compute
the hash of gradient cache entries, thus causing cache corruptions
and sometimes infinite loops (it would also cause the cache to fill
up.)
Change-Id: Ic807a9bf901888b121a6a781a81dafc33075ed2a
Diffstat (limited to 'libs/hwui/GradientCache.cpp')
-rw-r--r-- | libs/hwui/GradientCache.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp index 35a848725be6..154c0ecce5ed 100644 --- a/libs/hwui/GradientCache.cpp +++ b/libs/hwui/GradientCache.cpp @@ -49,7 +49,6 @@ static inline T min(T a, T b) { hash_t GradientCacheEntry::hash() const { uint32_t hash = JenkinsHashMix(0, count); - hash = JenkinsHashMix(hash, tileMode); for (uint32_t i = 0; i < count; i++) { hash = JenkinsHashMix(hash, android::hash_type(colors[i])); hash = JenkinsHashMix(hash, android::hash_type(positions[i])); @@ -61,9 +60,6 @@ int GradientCacheEntry::compare(const GradientCacheEntry& lhs, const GradientCac int deltaInt = int(lhs.count) - int(rhs.count); if (deltaInt != 0) return deltaInt; - deltaInt = lhs.tileMode - rhs.tileMode; - if (deltaInt != 0) return deltaInt; - deltaInt = memcmp(lhs.colors, rhs.colors, lhs.count * sizeof(uint32_t)); if (deltaInt != 0) return deltaInt; @@ -127,9 +123,7 @@ void GradientCache::operator()(GradientCacheEntry& shader, Texture*& texture) { if (texture) { const uint32_t size = texture->width * texture->height * GRADIENT_BYTES_PER_PIXEL; mSize -= size; - } - if (texture) { glDeleteTextures(1, &texture->id); delete texture; } @@ -140,7 +134,6 @@ void GradientCache::operator()(GradientCacheEntry& shader, Texture*& texture) { /////////////////////////////////////////////////////////////////////////////// Texture* GradientCache::get(uint32_t* colors, float* positions, int count) { - GradientCacheEntry gradient(colors, positions, count); Texture* texture = mCache.get(gradient); @@ -189,7 +182,7 @@ Texture* GradientCache::addLinearGradient(GradientCacheEntry& gradient, // Asume the cache is always big enough const uint32_t size = texture->width * texture->height * GRADIENT_BYTES_PER_PIXEL; - while (mSize + size > mMaxSize) { + while (getSize() + size > mMaxSize) { mCache.removeOldest(); } |