From 1271e2cc80b01d577e9db339459ef0222bb9320d Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Fri, 20 Apr 2012 09:54:27 -0700 Subject: Remove USE_DISPLAY_LIST_PROPERTIES flag This flag was still hanging around pending any need to disable DisplayList properties. But things seem stable, so it's time to clean up and simplify the code. At the same time, I reduced redundance in DisplayList dimensions. We used to call drawDisplayList() with width/height parameters that were used to do a clip reject. This is redundant with the DisplayList properties that set the bounds of the DisplayList; the left/right and top/bottom properties represent the same width/height properties formerly used in drawDisplayList(). The new approach is to not pass dimensions to drawDisplayList(), but to instead pull those dimensions directly from the DisplayList when needed. Change-Id: I8871beff03b1d4be95f7c6e079c31a71d31e0c56 --- core/java/android/widget/TextView.java | 53 +--------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) (limited to 'core/java/android/widget/TextView.java') diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 0e7fe7f3eb89..ed313230a8b0 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -261,8 +261,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // System wide time for last cut or copy action. static long LAST_CUT_OR_COPY_TIME; - private int mCurrentAlpha = 255; - private ColorStateList mTextColor; private ColorStateList mHintTextColor; private ColorStateList mLinkTextColor; @@ -4269,42 +4267,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return super.getResolvedLayoutDirection(who); } - @Override - protected boolean onSetAlpha(int alpha) { - // Alpha is supported if and only if the drawing can be done in one pass. - // TODO text with spans with a background color currently do not respect this alpha. - if (!USE_DISPLAY_LIST_PROPERTIES && - (getBackground() != null || mText instanceof Spannable || hasSelection())) { - if (mCurrentAlpha != alpha) { - mCurrentAlpha = alpha; - final Drawables dr = mDrawables; - if (dr != null) { - if (dr.mDrawableLeft != null) dr.mDrawableLeft.mutate().setAlpha(alpha); - if (dr.mDrawableTop != null) dr.mDrawableTop.mutate().setAlpha(alpha); - if (dr.mDrawableRight != null) dr.mDrawableRight.mutate().setAlpha(alpha); - if (dr.mDrawableBottom != null) dr.mDrawableBottom.mutate().setAlpha(alpha); - if (dr.mDrawableStart != null) dr.mDrawableStart.mutate().setAlpha(alpha); - if (dr.mDrawableEnd != null) dr.mDrawableEnd.mutate().setAlpha(alpha); - } - if (mEditor != null) getEditor().invalidateTextDisplayList(); - } - return true; - } - - if (mCurrentAlpha != 255) { - if (mEditor != null) getEditor().invalidateTextDisplayList(); - } - mCurrentAlpha = 255; - return false; - } - @Override public boolean hasOverlappingRendering() { - if (!USE_DISPLAY_LIST_PROPERTIES) { - return super.hasOverlappingRendering(); - } else { - return (getBackground() != null || mText instanceof Spannable || hasSelection()); - } + return (getBackground() != null || mText instanceof Spannable || hasSelection()); } /** @@ -4412,10 +4377,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // XXX should pass to skin instead of drawing directly highlightPaint.setColor(mCurTextColor); - if (mCurrentAlpha != 255) { - highlightPaint.setAlpha( - (mCurrentAlpha * Color.alpha(mCurTextColor)) / 255); - } highlightPaint.setStyle(Paint.Style.STROKE); highlight = mHighlightPath; } @@ -4429,10 +4390,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // XXX should pass to skin instead of drawing directly highlightPaint.setColor(mHighlightColor); - if (mCurrentAlpha != 255) { - highlightPaint.setAlpha( - (mCurrentAlpha * Color.alpha(mHighlightColor)) / 255); - } highlightPaint.setStyle(Paint.Style.FILL); highlight = mHighlightPath; @@ -4443,8 +4400,6 @@ 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 @@ -4531,10 +4486,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } mTextPaint.setColor(color); - if (mCurrentAlpha != 255) { - // If set, the alpha will override the color's alpha. Multiply the alphas. - mTextPaint.setAlpha((mCurrentAlpha * Color.alpha(color)) / 255); - } mTextPaint.drawableState = getDrawableState(); canvas.save(); @@ -7138,7 +7089,6 @@ 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 && mMarqueeFadeMode != MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) { if (mMarquee != null && !mMarquee.isStopped()) { @@ -7168,7 +7118,6 @@ 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 && mMarqueeFadeMode != MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) { if (mMarquee != null && !mMarquee.isStopped()) { -- cgit v1.2.3