From 6cfdf4538049e4b96f50d8c0fe3119664420cc34 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Fri, 22 Apr 2011 16:42:10 -0700 Subject: Fix bitfield bug with vertex shader selection Change-Id: I8bd3005f363afb52e6624806efb3e04c4a56ee18 --- libs/hwui/OpenGLRenderer.cpp | 5 ++++- libs/hwui/ProgramCache.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'libs/hwui') diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 7f28959..75f5a5f 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -897,7 +897,8 @@ void OpenGLRenderer::setupDrawColor(int color) { void OpenGLRenderer::setupDrawColor(int color, int alpha) { mColorA = alpha / 255.0f; - // BUG on this next line? a is alpha divided by 255 *twice* + // Second divide of a by 255 is an optimization, allowing us to simply multiply + // the rgb values by a instead of also dividing by 255 const float a = mColorA / 255.0f; mColorR = a * ((color >> 16) & 0xFF); mColorG = a * ((color >> 8) & 0xFF); @@ -908,6 +909,8 @@ void OpenGLRenderer::setupDrawColor(int color, int alpha) { void OpenGLRenderer::setupDrawAlpha8Color(int color, int alpha) { mColorA = alpha / 255.0f; + // Double-divide of a by 255 is an optimization, allowing us to simply multiply + // the rgb values by a instead of also dividing by 255 const float a = mColorA / 255.0f; mColorR = a * ((color >> 16) & 0xFF); mColorG = a * ((color >> 8) & 0xFF); diff --git a/libs/hwui/ProgramCache.h b/libs/hwui/ProgramCache.h index cead75b..9a7a2d2 100644 --- a/libs/hwui/ProgramCache.h +++ b/libs/hwui/ProgramCache.h @@ -57,7 +57,7 @@ namespace uirenderer { #define PROGRAM_KEY_COLOR_BLEND 0x80 #define PROGRAM_KEY_BITMAP_NPOT 0x100 #define PROGRAM_KEY_SWAP_SRC_DST 0x2000 -#define PROGRAM_KEY_VERTEX_WIDTH 0x4000 +#define PROGRAM_KEY_VERTEX_WIDTH (1 << 37) #define PROGRAM_KEY_BITMAP_WRAPS_MASK 0x600 #define PROGRAM_KEY_BITMAP_WRAPT_MASK 0x1800 -- cgit v1.1