diff options
| author | Romain Guy <romainguy@google.com> | 2012-07-13 12:13:07 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2012-07-13 12:24:09 -0700 |
| commit | 0a386ffac026e259c408b77c2dd2cc5d2e22b5f8 (patch) | |
| tree | 73000a03928fb3a3ee5c384f1ea74e28b3c3ee3b /libs/hwui/OpenGLRenderer.cpp | |
| parent | 0f8e402e954c6e37102fa70f81a1d8ec47156338 (diff) | |
| download | frameworks_base-0a386ffac026e259c408b77c2dd2cc5d2e22b5f8.zip frameworks_base-0a386ffac026e259c408b77c2dd2cc5d2e22b5f8.tar.gz frameworks_base-0a386ffac026e259c408b77c2dd2cc5d2e22b5f8.tar.bz2 | |
Text shadow alpha handling incorrect
DO NOT MERGE
External bug: http://code.google.com/p/android/issues/detail?id=34879
This is a regression from ICS.
This CL also fixes a bug where a View's alpha would be applied twice.
Change-Id: I13a1546228f44d4c169259414b6fa103a6e4a0fa
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index c92bead..9a90bfd 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1149,7 +1149,6 @@ void OpenGLRenderer::setupDrawColor(int color) { void OpenGLRenderer::setupDrawColor(int color, int alpha) { mColorA = alpha / 255.0f; - mColorA *= mSnapshot->alpha; // 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; @@ -1181,15 +1180,6 @@ void OpenGLRenderer::setupDrawColor(float r, float g, float b, float a) { mSetShaderColor = mDescription.setColor(r, g, b, a); } -void OpenGLRenderer::setupDrawAlpha8Color(float r, float g, float b, float a) { - mColorA = a; - mColorR = r; - mColorG = g; - mColorB = b; - mColorSet = true; - mSetShaderColor = mDescription.setAlpha8Color(r, g, b, a); -} - void OpenGLRenderer::setupDrawShader() { if (mShader) { mShader->describe(mDescription, mCaches.extensions); @@ -1771,7 +1761,7 @@ void OpenGLRenderer::drawAARect(float left, float top, float right, float bottom setupDraw(); setupDrawNoTexture(); setupDrawAALine(); - setupDrawColor(color); + setupDrawColor(color, ((color >> 24) & 0xFF) * mSnapshot->alpha); setupDrawColorFilter(); setupDrawShader(); setupDrawBlending(true, mode); @@ -2267,7 +2257,7 @@ status_t OpenGLRenderer::drawRect(float left, float top, float right, float bott status_t OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count, const float* positions, SkPaint* paint) { if (text == NULL || count == 0 || mSnapshot->isIgnored() || - (paint->getAlpha() == 0 && paint->getXfermode() == NULL)) { + (paint->getAlpha() * mSnapshot->alpha == 0 && paint->getXfermode() == NULL)) { return DrawGlInfo::kStatusDone; } @@ -2340,7 +2330,7 @@ status_t OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count, float x, float y, SkPaint* paint, float length) { if (text == NULL || count == 0 || mSnapshot->isIgnored() || - (paint->getAlpha() == 0 && paint->getXfermode() == NULL)) { + (paint->getAlpha() * mSnapshot->alpha == 0 && paint->getXfermode() == NULL)) { return DrawGlInfo::kStatusDone; } @@ -2393,7 +2383,7 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count, const float sx = oldX - shadow->left + mShadowDx; const float sy = oldY - shadow->top + mShadowDy; - const int shadowAlpha = ((mShadowColor >> 24) & 0xFF); + const int shadowAlpha = ((mShadowColor >> 24) & 0xFF) * mSnapshot->alpha; int shadowColor = mShadowColor; if (mShader) { shadowColor = 0xffffffff; @@ -2792,7 +2782,7 @@ void OpenGLRenderer::drawColorRect(float left, float top, float right, float bot setupDraw(); setupDrawNoTexture(); - setupDrawColor(color); + setupDrawColor(color, ((color >> 24) & 0xFF) * mSnapshot->alpha); setupDrawShader(); setupDrawColorFilter(); setupDrawBlending(mode); |
