From 1d4e6a0901e5d26f4319ed173b4aa7b907350d93 Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 11 Feb 2016 13:22:25 -0800 Subject: [PATCH] Fix bpp mismatch Bug: 26980851 GL_RGBA16F was being incorrectly calculated as 4 bpp instead of 16 in Texture's objectSize(), leading to a mismatch in cache size tracking in GradientCache Change-Id: I533c52fcdf9910d7a7d14bbd80965b8cbef8e147 --- libs/hwui/GradientCache.cpp | 4 ++++ libs/hwui/Texture.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp index 11293d61211b2..88ae02b5524d1 100644 --- a/libs/hwui/GradientCache.cpp +++ b/libs/hwui/GradientCache.cpp @@ -165,6 +165,10 @@ Texture* GradientCache::addLinearGradient(GradientCacheEntry& gradient, generateTexture(colors, positions, info.width, 2, texture); mSize += size; + LOG_ALWAYS_FATAL_IF((int)size != texture->objectSize(), + "size != texture->objectSize(), size %" PRIu32 ", objectSize %" PRIu32 + " width = %" PRIu32 " bytesPerPixel() = %" PRIu32, + size, texture->objectSize(), info.width, bytesPerPixel()); mCache.put(gradient, texture); return texture; diff --git a/libs/hwui/Texture.cpp b/libs/hwui/Texture.cpp index c09b6dd89e4ed..49a103c01108c 100644 --- a/libs/hwui/Texture.cpp +++ b/libs/hwui/Texture.cpp @@ -33,8 +33,11 @@ static int bytesPerPixel(GLint glFormat) { case GL_RGB: return 3; case GL_RGBA: - default: return 4; + case GL_RGBA16F: + return 16; + default: + LOG_ALWAYS_FATAL("UNKNOWN FORMAT %d", glFormat); } }