summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2013-02-27 13:50:45 -0800
committer Romain Guy <romainguy@google.com> 2013-02-27 13:52:26 -0800
commit768bffc9b814f6a1f7d9ff59d91285895c23bbe9 (patch)
tree49da21e344249af8273fe418e13fe03235eb9c76 /libs/hwui/OpenGLRenderer.cpp
parentc0e55bd3cfe1d7be2276e4f528fee2231763a5c1 (diff)
Draw text drop shadows even when the text color is transparent
This matches Skia's behavior. Change-Id: Ibf0a52611f5801cfa68169f66ab0ec06f256600f
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 34d1c983f87d..ee54462275aa 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -2555,10 +2555,14 @@ void OpenGLRenderer::drawTextShadow(SkPaint* paint, const char* text, int bytesC
glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
}
+bool OpenGLRenderer::canSkipText(const SkPaint* paint) const {
+ float alpha = (mDrawModifiers.mHasShadow ? 1.0f : paint->getAlpha()) * mSnapshot->alpha;
+ return alpha == 0.0f && getXfermode(paint->getXfermode()) == SkXfermode::kSrcOver_Mode;
+}
+
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() * mSnapshot->alpha == 0 && paint->getXfermode() == NULL)) {
+ if (text == NULL || count == 0 || mSnapshot->isIgnored() || canSkipText(paint)) {
return DrawGlInfo::kStatusDone;
}
@@ -2630,8 +2634,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, const float* positions, SkPaint* paint, float length) {
- if (text == NULL || count == 0 || mSnapshot->isIgnored() ||
- (paint->getAlpha() * mSnapshot->alpha == 0 && paint->getXfermode() == NULL)) {
+ if (text == NULL || count == 0 || mSnapshot->isIgnored() || canSkipText(paint)) {
return DrawGlInfo::kStatusDone;
}
@@ -2735,8 +2738,7 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
status_t OpenGLRenderer::drawTextOnPath(const char* text, int bytesCount, int count, SkPath* path,
float hOffset, float vOffset, SkPaint* paint) {
- if (text == NULL || count == 0 || mSnapshot->isIgnored() ||
- (paint->getAlpha() == 0 && paint->getXfermode() == NULL)) {
+ if (text == NULL || count == 0 || mSnapshot->isIgnored() || canSkipText(paint)) {
return DrawGlInfo::kStatusDone;
}