diff options
| author | 2010-10-13 18:19:48 -0700 | |
|---|---|---|
| committer | 2010-10-13 18:19:48 -0700 | |
| commit | 909cbaf8f92d69f507bbdba9e5aa960d1e6c7a1f (patch) | |
| tree | e0b26f1015f875c9490bb1cfeceb76d3c40c1fd0 | |
| parent | 5d794412e3e429e47404395badcd11b0b8639e8b (diff) | |
Don't draw TextView's alpha layers when not needed.
Change-Id: Iedf42cbc62d727f18500c78fcccf2d081a761fec
| -rw-r--r-- | core/java/android/view/ViewConfiguration.java | 6 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 5 | ||||
| -rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index f41347569dbd..85981d2137dc 100644 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -37,7 +37,11 @@ public class ViewConfiguration { * @hide */ public static final float ALPHA_THRESHOLD = 0.5f / PANEL_BIT_DEPTH; - + /** + * @hide + */ + public static final float ALPHA_THRESHOLD_INT = 0x7f / PANEL_BIT_DEPTH; + /** * Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in * pixels diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 9c80ef87d86f..fccf1550245e 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -16,6 +16,7 @@ package android.widget; +import android.view.ViewConfiguration; import com.android.internal.util.FastMath; import com.android.internal.widget.EditableInputConnection; @@ -3954,6 +3955,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override protected void onDraw(Canvas canvas) { + if (mCurrentAlpha <= ViewConfiguration.ALPHA_THRESHOLD_INT) return; + restartMarqueeIfNeeded(); // Draw the background for this view @@ -7047,6 +7050,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override protected float getLeftFadingEdgeStrength() { + if (mCurrentAlpha <= ViewConfiguration.ALPHA_THRESHOLD_INT) return 0.0f; if (mEllipsize == TextUtils.TruncateAt.MARQUEE) { if (mMarquee != null && !mMarquee.isStopped()) { final Marquee marquee = mMarquee; @@ -7073,6 +7077,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override protected float getRightFadingEdgeStrength() { + if (mCurrentAlpha <= ViewConfiguration.ALPHA_THRESHOLD_INT) return 0.0f; if (mEllipsize == TextUtils.TruncateAt.MARQUEE) { if (mMarquee != null && !mMarquee.isStopped()) { final Marquee marquee = mMarquee; diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index d81760d96c83..ac3bc9c3ee46 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -455,6 +455,7 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, #endif // Clear the FBO + bounds.snapToPixelBoundaries(); glScissor(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight()); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); |