diff options
| author | Chet Haase <chet@google.com> | 2012-04-20 09:54:27 -0700 |
|---|---|---|
| committer | Chet Haase <chet@google.com> | 2012-04-23 11:13:17 -0700 |
| commit | 1271e2cc80b01d577e9db339459ef0222bb9320d (patch) | |
| tree | d308bb451af2ecf76715ec0389de3e95b60e6d5a /core/java/android/widget | |
| parent | 003952ba33f711963ad26588b2aca293deb8d50a (diff) | |
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
Diffstat (limited to 'core/java/android/widget')
| -rw-r--r-- | core/java/android/widget/Editor.java | 10 | ||||
| -rw-r--r-- | core/java/android/widget/ImageView.java | 20 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 53 |
3 files changed, 6 insertions, 77 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index d2d4e1792d2c..9d39a0740d27 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -1286,18 +1286,16 @@ public class Editor { } finally { hardwareCanvas.onPostDraw(); blockDisplayList.end(); - if (View.USE_DISPLAY_LIST_PROPERTIES) { - blockDisplayList.setLeftTopRightBottom(0, top, width, bottom); - // Same as drawDisplayList below, handled by our TextView's parent - blockDisplayList.setClipChildren(false); - } + blockDisplayList.setLeftTopRightBottom(0, top, width, bottom); + // Same as drawDisplayList below, handled by our TextView's parent + blockDisplayList.setClipChildren(false); } } // TODO When View.USE_DISPLAY_LIST_PROPERTIES is the only code path, the // width and height parameters should be removed and the bounds set above in // setLeftTopRightBottom should be used instead for quick rejection. - ((HardwareCanvas) canvas).drawDisplayList(blockDisplayList, width, height, null, + ((HardwareCanvas) canvas).drawDisplayList(blockDisplayList, null, 0 /* no child clipping, our TextView parent enforces it */); endOfPreviousBlock = blockEndLine; } diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index 6c7ea6731ca6..7593bffc132a 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -200,26 +200,8 @@ public class ImageView extends View { } @Override - protected boolean onSetAlpha(int alpha) { - if (!USE_DISPLAY_LIST_PROPERTIES && getBackground() == null) { - int scale = alpha + (alpha >> 7); - if (mViewAlphaScale != scale) { - mViewAlphaScale = scale; - mColorMod = true; - applyColorMod(); - } - return true; - } - return false; - } - - @Override public boolean hasOverlappingRendering() { - if (!USE_DISPLAY_LIST_PROPERTIES) { - return super.hasOverlappingRendering(); - } else { - return (getBackground() != null); - } + return (getBackground() != null); } @Override 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; @@ -4270,41 +4268,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } @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()) { |
