summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
author Chet Haase <chet@google.com> 2011-04-25 12:56:34 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-04-25 12:56:34 -0700
commitcc5a7d2328f7662fd4b17eb542c73cffbf799b9c (patch)
tree239944e4077269ea95907113d8fb2e83e25657f6 /libs/hwui/OpenGLRenderer.cpp
parenta13802d8805c2af2fae4d64e3dee99abd73ecfa9 (diff)
parent6cfdf4538049e4b96f50d8c0fe3119664420cc34 (diff)
Merge "Fix bitfield bug with vertex shader selection"
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 7f28959f5423..75f5a5f6e617 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);