diff options
-rw-r--r-- | core/java/android/view/GLES20Canvas.java | 7 | ||||
-rw-r--r-- | core/java/android/view/HardwareCanvas.java | 9 | ||||
-rw-r--r-- | core/java/android/view/HardwareRenderer.java | 3 | ||||
-rw-r--r-- | core/java/android/view/View.java | 78 | ||||
-rw-r--r-- | core/java/android/view/ViewGroup.java | 12 | ||||
-rw-r--r-- | core/java/android/view/ViewPropertyAnimator.java | 5 | ||||
-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 | ||||
-rw-r--r-- | core/jni/android_view_GLES20Canvas.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 280 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.h | 22 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 11 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 4 |
14 files changed, 199 insertions, 321 deletions
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index bedafc7..7736f57 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -358,14 +358,13 @@ class GLES20Canvas extends HardwareCanvas { private static native void nSetDisplayListName(int displayList, String name); @Override - public int drawDisplayList(DisplayList displayList, int width, int height, - Rect dirty, int flags) { + public int drawDisplayList(DisplayList displayList, Rect dirty, int flags) { return nDrawDisplayList(mRenderer, ((GLES20DisplayList) displayList).getNativeDisplayList(), - width, height, dirty, flags); + dirty, flags); } private static native int nDrawDisplayList(int renderer, int displayList, - int width, int height, Rect dirty, int flags); + Rect dirty, int flags); @Override void outputDisplayList(DisplayList displayList) { diff --git a/core/java/android/view/HardwareCanvas.java b/core/java/android/view/HardwareCanvas.java index de8c62d..2f4cd36 100644 --- a/core/java/android/view/HardwareCanvas.java +++ b/core/java/android/view/HardwareCanvas.java @@ -48,13 +48,11 @@ public abstract class HardwareCanvas extends Canvas { * Invoked after all drawing operation have been performed. */ public abstract void onPostDraw(); - + /** * Draws the specified display list onto this canvas. - * + * * @param displayList The display list to replay. - * @param width The width of the display list. - * @param height The height of the display list. * @param dirty The dirty region to redraw in the next pass, matters only * if this method returns true, can be null. * @param flags Optional flags about drawing, see {@link DisplayList} for @@ -63,8 +61,7 @@ public abstract class HardwareCanvas extends Canvas { * @return One of {@link DisplayList#STATUS_DONE}, {@link DisplayList#STATUS_DRAW} or * {@link DisplayList#STATUS_INVOKE} */ - public abstract int drawDisplayList(DisplayList displayList, int width, int height, - Rect dirty, int flags); + public abstract int drawDisplayList(DisplayList displayList, Rect dirty, int flags); /** * Outputs the specified display list to the log. This method exists for use by diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 8bc36b7..5d9505d 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -1099,8 +1099,7 @@ public abstract class HardwareRenderer { drawDisplayListStartTime = System.nanoTime(); } - int status = canvas.drawDisplayList(displayList, - view.getWidth(), view.getHeight(), mRedrawClip, + int status = canvas.drawDisplayList(displayList, mRedrawClip, DisplayList.FLAG_CLIP_CHILDREN); if (mProfileEnabled) { diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a299141..a833cbe 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -1531,14 +1531,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal static final ThreadLocal<Rect> sThreadLocal = new ThreadLocal<Rect>(); /** - * Temporary flag, used to enable processing of View properties in the native DisplayList - * object instead of during draw(). Soon to be enabled by default for hardware-accelerated - * apps. - * @hide - */ - public static final boolean USE_DISPLAY_LIST_PROPERTIES = true; - - /** * Map used to store views' tags. */ private SparseArray<Object> mKeyedTags; @@ -8269,7 +8261,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mMatrixDirty = true; invalidateViewProperty(false, false); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setCameraDistance(-Math.abs(distance) / dpi); } } @@ -8311,7 +8303,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mRotation = rotation; info.mMatrixDirty = true; invalidateViewProperty(false, true); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setRotation(rotation); } } @@ -8358,7 +8350,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mRotationY = rotationY; info.mMatrixDirty = true; invalidateViewProperty(false, true); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setRotationY(rotationY); } } @@ -8405,7 +8397,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mRotationX = rotationX; info.mMatrixDirty = true; invalidateViewProperty(false, true); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setRotationX(rotationX); } } @@ -8444,7 +8436,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mScaleX = scaleX; info.mMatrixDirty = true; invalidateViewProperty(false, true); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setScaleX(scaleX); } } @@ -8483,7 +8475,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mScaleY = scaleY; info.mMatrixDirty = true; invalidateViewProperty(false, true); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setScaleY(scaleY); } } @@ -8530,7 +8522,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mPivotX = pivotX; info.mMatrixDirty = true; invalidateViewProperty(false, true); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setPivotX(pivotX); } } @@ -8576,7 +8568,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mPivotY = pivotY; info.mMatrixDirty = true; invalidateViewProperty(false, true); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setPivotY(pivotY); } } @@ -8642,7 +8634,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } else { mPrivateFlags &= ~ALPHA_SET; invalidateViewProperty(true, false); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setAlpha(alpha); } } @@ -8669,7 +8661,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal return true; } else { mPrivateFlags &= ~ALPHA_SET; - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setAlpha(alpha); } } @@ -8721,7 +8713,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal int oldHeight = mBottom - mTop; mTop = top; - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setTop(mTop); } @@ -8790,7 +8782,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal int oldHeight = mBottom - mTop; mBottom = bottom; - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setBottom(mBottom); } @@ -8853,7 +8845,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal int height = mBottom - mTop; mLeft = left; - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setLeft(left); } @@ -8869,9 +8861,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } mBackgroundSizeChanged = true; invalidateParentIfNeeded(); - if (USE_DISPLAY_LIST_PROPERTIES) { - - } } } @@ -8916,7 +8905,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal int height = mBottom - mTop; mRight = right; - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setRight(mRight); } @@ -9013,7 +9002,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mTranslationX = translationX; info.mMatrixDirty = true; invalidateViewProperty(false, true); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setTranslationX(translationX); } } @@ -9050,7 +9039,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal info.mTranslationY = translationY; info.mMatrixDirty = true; invalidateViewProperty(false, true); - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setTranslationY(translationY); } } @@ -9161,7 +9150,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal final boolean matrixIsIdentity = mTransformationInfo == null || mTransformationInfo.mMatrixIsIdentity; if (matrixIsIdentity) { - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { invalidateViewProperty(false, false); } else { final ViewParent p = mParent; @@ -9189,7 +9178,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal mTop += offset; mBottom += offset; - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.offsetTopBottom(offset); invalidateViewProperty(false, false); } else { @@ -9212,7 +9201,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal final boolean matrixIsIdentity = mTransformationInfo == null || mTransformationInfo.mMatrixIsIdentity; if (matrixIsIdentity) { - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { invalidateViewProperty(false, false); } else { final ViewParent p = mParent; @@ -9237,7 +9226,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal mLeft += offset; mRight += offset; - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.offsetLeftRight(offset); invalidateViewProperty(false, false); } else { @@ -9666,8 +9655,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * list properties are not being used in this view */ void invalidateViewProperty(boolean invalidateParent, boolean forceRedraw) { - if (!USE_DISPLAY_LIST_PROPERTIES || mDisplayList == null || - (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION) { + if (mDisplayList == null || (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION) { if (invalidateParent) { invalidateParentCaches(); } @@ -11759,7 +11747,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal int layerType = ( !(mParent instanceof ViewGroup) || ((ViewGroup)mParent).mDrawLayers) ? getLayerType() : LAYER_TYPE_NONE; - if (!isLayer && layerType != LAYER_TYPE_NONE && USE_DISPLAY_LIST_PROPERTIES) { + if (!isLayer && layerType != LAYER_TYPE_NONE) { if (layerType == LAYER_TYPE_HARDWARE) { final HardwareLayer layer = getHardwareLayer(); if (layer != null && layer.isValid()) { @@ -11782,9 +11770,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal computeScroll(); - if (!USE_DISPLAY_LIST_PROPERTIES) { - restoreCount = canvas.save(); - } canvas.translate(-mScrollX, -mScrollY); if (!isLayer) { mPrivateFlags |= DRAWN | DRAWING_CACHE_VALID; @@ -11799,16 +11784,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } } finally { - if (USE_DISPLAY_LIST_PROPERTIES) { - canvas.restoreToCount(restoreCount); - } canvas.onPostDraw(); displayList.end(); - if (USE_DISPLAY_LIST_PROPERTIES) { - displayList.setCaching(caching); - } - if (isLayer && USE_DISPLAY_LIST_PROPERTIES) { + displayList.setCaching(caching); + if (isLayer) { displayList.setLeftTopRightBottom(0, 0, width, height); } else { setDisplayListProperties(displayList); @@ -12400,7 +12380,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * previously-set transform values */ void setDisplayListProperties(DisplayList displayList) { - if (USE_DISPLAY_LIST_PROPERTIES && displayList != null) { + if (displayList != null) { displayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom); displayList.setHasOverlappingRendering(hasOverlappingRendering()); if (mParent instanceof ViewGroup) { @@ -12460,8 +12440,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * to be called from anywhere else other than ViewGroup.drawChild(). */ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { - boolean useDisplayListProperties = USE_DISPLAY_LIST_PROPERTIES && mAttachInfo != null && - mAttachInfo.mHardwareAccelerated; + boolean useDisplayListProperties = mAttachInfo != null && mAttachInfo.mHardwareAccelerated; boolean more = false; final boolean childHasIdentityMatrix = hasIdentityMatrix(); final int flags = parent.mGroupFlags; @@ -12722,8 +12701,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } else { mPrivateFlags &= ~DIRTY_MASK; - ((HardwareCanvas) canvas).drawDisplayList(displayList, - mRight - mLeft, mBottom - mTop, null, flags); + ((HardwareCanvas) canvas).drawDisplayList(displayList, null, flags); } } } else if (cache != null) { @@ -13211,7 +13189,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal mTop = top; mRight = right; mBottom = bottom; - if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) { + if (mDisplayList != null) { mDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom); } diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 1641d4c..8c8711c 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2898,12 +2898,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager boolean previousValue = (mGroupFlags & FLAG_CLIP_CHILDREN) == FLAG_CLIP_CHILDREN; if (clipChildren != previousValue) { setBooleanFlag(FLAG_CLIP_CHILDREN, clipChildren); - if (USE_DISPLAY_LIST_PROPERTIES) { - for (int i = 0; i < mChildrenCount; ++i) { - View child = getChildAt(i); - if (child.mDisplayList != null) { - child.mDisplayList.setClipChildren(clipChildren); - } + for (int i = 0; i < mChildrenCount; ++i) { + View child = getChildAt(i); + if (child.mDisplayList != null) { + child.mDisplayList.setClipChildren(clipChildren); } } } @@ -4229,7 +4227,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final View v = children[i]; v.mTop += offset; v.mBottom += offset; - if (USE_DISPLAY_LIST_PROPERTIES && v.mDisplayList != null) { + if (v.mDisplayList != null) { v.mDisplayList.offsetTopBottom(offset); invalidateViewProperty(false, false); } diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java index e573056..ec37acf 100644 --- a/core/java/android/view/ViewPropertyAnimator.java +++ b/core/java/android/view/ViewPropertyAnimator.java @@ -835,7 +835,7 @@ public class ViewPropertyAnimator { */ private void setValue(int propertyConstant, float value) { final View.TransformationInfo info = mView.mTransformationInfo; - DisplayList displayList = View.USE_DISPLAY_LIST_PROPERTIES ? mView.mDisplayList : null; + final DisplayList displayList = mView.mDisplayList; switch (propertyConstant) { case TRANSLATION_X: info.mTranslationX = value; @@ -997,8 +997,7 @@ public class ViewPropertyAnimator { // Shouldn't happen, but just to play it safe return; } - boolean useDisplayListProperties = View.USE_DISPLAY_LIST_PROPERTIES && - mView.mDisplayList != null; + boolean useDisplayListProperties = mView.mDisplayList != null; // alpha requires slightly different treatment than the other (transform) properties. // The logic in setAlpha() is not simply setting mAlpha, plus the invalidation diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index d2d4e17..9d39a07 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 6c7ea67..7593bff 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 0e7fe7f..ed31323 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()) { diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index 6028814..d4d60d3 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -660,9 +660,9 @@ static void android_view_GLES20Canvas_destroyDisplayList(JNIEnv* env, static jint android_view_GLES20Canvas_drawDisplayList(JNIEnv* env, jobject clazz, OpenGLRenderer* renderer, DisplayList* displayList, - jint width, jint height, jobject dirty, jint flags) { + jobject dirty, jint flags) { android::uirenderer::Rect bounds; - status_t status = renderer->drawDisplayList(displayList, width, height, bounds, flags); + status_t status = renderer->drawDisplayList(displayList, bounds, flags); if (status != DrawGlInfo::kStatusDone && dirty != NULL) { env->CallVoidMethod(dirty, gRectClassInfo.set, int(bounds.left), int(bounds.top), int(bounds.right), int(bounds.bottom)); @@ -917,7 +917,7 @@ static JNINativeMethod gMethods[] = { { "nGetDisplayListSize", "(I)I", (void*) android_view_GLES20Canvas_getDisplayListSize }, { "nSetDisplayListName", "(ILjava/lang/String;)V", (void*) android_view_GLES20Canvas_setDisplayListName }, - { "nDrawDisplayList", "(IIIILandroid/graphics/Rect;I)I", + { "nDrawDisplayList", "(IILandroid/graphics/Rect;I)I", (void*) android_view_GLES20Canvas_drawDisplayList }, { "nCreateDisplayListRenderer", "()I", (void*) android_view_GLES20Canvas_createDisplayListRenderer }, diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 3910739..7e19932 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -143,18 +143,16 @@ void DisplayList::destroyDisplayListDeferred(DisplayList* displayList) { void DisplayList::clearResources() { sk_free((void*) mReader.base()); - if (USE_DISPLAY_LIST_PROPERTIES) { - delete mTransformMatrix; - delete mTransformCamera; - delete mTransformMatrix3D; - delete mStaticMatrix; - delete mAnimationMatrix; - mTransformMatrix = NULL; - mTransformCamera = NULL; - mTransformMatrix3D = NULL; - mStaticMatrix = NULL; - mAnimationMatrix = NULL; - } + delete mTransformMatrix; + delete mTransformCamera; + delete mTransformMatrix3D; + delete mStaticMatrix; + delete mAnimationMatrix; + mTransformMatrix = NULL; + mTransformCamera = NULL; + mTransformMatrix3D = NULL; + mStaticMatrix = NULL; + mAnimationMatrix = NULL; Caches& caches = Caches::getInstance(); @@ -274,6 +272,7 @@ void DisplayList::output(OpenGLRenderer& renderer, uint32_t level) { indent[count] = '\0'; ALOGD("%sStart display list (%p, %s)", (char*) indent + 2, this, mName.string()); + ALOGD("%s%s %d", indent, "Save", SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); int saveCount = renderer.getSaveCount() - 1; outputViewProperties(renderer, (char*) indent); @@ -377,11 +376,9 @@ void DisplayList::output(OpenGLRenderer& renderer, uint32_t level) { break; case DrawDisplayList: { DisplayList* displayList = getDisplayList(); - uint32_t width = getUInt(); - uint32_t height = getUInt(); int32_t flags = getInt(); ALOGD("%s%s %p, %dx%d, 0x%x %d", (char*) indent, OP_NAMES[op], - displayList, width, height, flags, level + 1); + displayList, mWidth, mHeight, flags, level + 1); renderer.outputDisplayList(displayList, level + 1); } break; @@ -664,64 +661,60 @@ void DisplayList::updateMatrix() { } void DisplayList::outputViewProperties(OpenGLRenderer& renderer, char* indent) { - if (USE_DISPLAY_LIST_PROPERTIES) { - updateMatrix(); - if (mLeft != 0 || mTop != 0) { - ALOGD("%s%s %d, %d", indent, "Translate (left, top)", mLeft, mTop); - } - if (mStaticMatrix) { - ALOGD("%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", - indent, "ConcatMatrix (static)", mStaticMatrix, - mStaticMatrix->get(0), mStaticMatrix->get(1), - mStaticMatrix->get(2), mStaticMatrix->get(3), - mStaticMatrix->get(4), mStaticMatrix->get(5), - mStaticMatrix->get(6), mStaticMatrix->get(7), - mStaticMatrix->get(8)); - } - if (mAnimationMatrix) { + updateMatrix(); + if (mLeft != 0 || mTop != 0) { + ALOGD("%s%s %d, %d", indent, "Translate (left, top)", mLeft, mTop); + } + if (mStaticMatrix) { + ALOGD("%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", + indent, "ConcatMatrix (static)", mStaticMatrix, + mStaticMatrix->get(0), mStaticMatrix->get(1), + mStaticMatrix->get(2), mStaticMatrix->get(3), + mStaticMatrix->get(4), mStaticMatrix->get(5), + mStaticMatrix->get(6), mStaticMatrix->get(7), + mStaticMatrix->get(8)); + } + if (mAnimationMatrix) { + ALOGD("%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", + indent, "ConcatMatrix (animation)", mAnimationMatrix, + mAnimationMatrix->get(0), mAnimationMatrix->get(1), + mAnimationMatrix->get(2), mAnimationMatrix->get(3), + mAnimationMatrix->get(4), mAnimationMatrix->get(5), + mAnimationMatrix->get(6), mAnimationMatrix->get(7), + mAnimationMatrix->get(8)); + } + if (mMatrixFlags != 0) { + if (mMatrixFlags == TRANSLATION) { + ALOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY); + } else { ALOGD("%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", - indent, "ConcatMatrix (animation)", mAnimationMatrix, - mAnimationMatrix->get(0), mAnimationMatrix->get(1), - mAnimationMatrix->get(2), mAnimationMatrix->get(3), - mAnimationMatrix->get(4), mAnimationMatrix->get(5), - mAnimationMatrix->get(6), mAnimationMatrix->get(7), - mAnimationMatrix->get(8)); - } - if (mMatrixFlags != 0) { - if (mMatrixFlags == TRANSLATION) { - ALOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY); - } else { - ALOGD("%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", - indent, "ConcatMatrix", mTransformMatrix, - mTransformMatrix->get(0), mTransformMatrix->get(1), - mTransformMatrix->get(2), mTransformMatrix->get(3), - mTransformMatrix->get(4), mTransformMatrix->get(5), - mTransformMatrix->get(6), mTransformMatrix->get(7), - mTransformMatrix->get(8)); - } - } - if (mAlpha < 1 && !mCaching) { - // TODO: should be able to store the size of a DL at record time and not - // have to pass it into this call. In fact, this information might be in the - // location/size info that we store with the new native transform data. - int flags = SkCanvas::kHasAlphaLayer_SaveFlag; - if (mClipChildren) { - flags |= SkCanvas::kClipToLayer_SaveFlag; - } - ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha", - (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop, - mMultipliedAlpha, flags); + indent, "ConcatMatrix", mTransformMatrix, + mTransformMatrix->get(0), mTransformMatrix->get(1), + mTransformMatrix->get(2), mTransformMatrix->get(3), + mTransformMatrix->get(4), mTransformMatrix->get(5), + mTransformMatrix->get(6), mTransformMatrix->get(7), + mTransformMatrix->get(8)); } + } + if (mAlpha < 1 && !mCaching) { + // TODO: should be able to store the size of a DL at record time and not + // have to pass it into this call. In fact, this information might be in the + // location/size info that we store with the new native transform data. + int flags = SkCanvas::kHasAlphaLayer_SaveFlag; if (mClipChildren) { - ALOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f, - (float) mRight - mLeft, (float) mBottom - mTop); + flags |= SkCanvas::kClipToLayer_SaveFlag; } + ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha", + (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop, + mMultipliedAlpha, flags); + } + if (mClipChildren) { + ALOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f, + (float) mRight - mLeft, (float) mBottom - mTop); } } -void DisplayList::setViewProperties(OpenGLRenderer& renderer, uint32_t width, uint32_t height, - uint32_t level) { - if (USE_DISPLAY_LIST_PROPERTIES) { +void DisplayList::setViewProperties(OpenGLRenderer& renderer, uint32_t level) { #if DEBUG_DISPLAY_LIST uint32_t count = (level + 1) * 2; char indent[count + 1]; @@ -730,73 +723,72 @@ void DisplayList::setViewProperties(OpenGLRenderer& renderer, uint32_t width, ui } indent[count] = '\0'; #endif - updateMatrix(); - if (mLeft != 0 || mTop != 0) { - DISPLAY_LIST_LOGD("%s%s %d, %d", indent, "Translate (left, top)", mLeft, mTop); - renderer.translate(mLeft, mTop); - } - if (mStaticMatrix) { - DISPLAY_LIST_LOGD( - "%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", - indent, "ConcatMatrix (static)", mStaticMatrix, - mStaticMatrix->get(0), mStaticMatrix->get(1), - mStaticMatrix->get(2), mStaticMatrix->get(3), - mStaticMatrix->get(4), mStaticMatrix->get(5), - mStaticMatrix->get(6), mStaticMatrix->get(7), - mStaticMatrix->get(8)); - renderer.concatMatrix(mStaticMatrix); - } else if (mAnimationMatrix) { + updateMatrix(); + if (mLeft != 0 || mTop != 0) { + DISPLAY_LIST_LOGD("%s%s %d, %d", indent, "Translate (left, top)", mLeft, mTop); + renderer.translate(mLeft, mTop); + } + if (mStaticMatrix) { + DISPLAY_LIST_LOGD( + "%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", + indent, "ConcatMatrix (static)", mStaticMatrix, + mStaticMatrix->get(0), mStaticMatrix->get(1), + mStaticMatrix->get(2), mStaticMatrix->get(3), + mStaticMatrix->get(4), mStaticMatrix->get(5), + mStaticMatrix->get(6), mStaticMatrix->get(7), + mStaticMatrix->get(8)); + renderer.concatMatrix(mStaticMatrix); + } else if (mAnimationMatrix) { + DISPLAY_LIST_LOGD( + "%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", + indent, "ConcatMatrix (animation)", mAnimationMatrix, + mAnimationMatrix->get(0), mAnimationMatrix->get(1), + mAnimationMatrix->get(2), mAnimationMatrix->get(3), + mAnimationMatrix->get(4), mAnimationMatrix->get(5), + mAnimationMatrix->get(6), mAnimationMatrix->get(7), + mAnimationMatrix->get(8)); + renderer.concatMatrix(mAnimationMatrix); + } + if (mMatrixFlags != 0) { + if (mMatrixFlags == TRANSLATION) { + DISPLAY_LIST_LOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY); + renderer.translate(mTranslationX, mTranslationY); + } else { DISPLAY_LIST_LOGD( "%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", - indent, "ConcatMatrix (animation)", mAnimationMatrix, - mAnimationMatrix->get(0), mAnimationMatrix->get(1), - mAnimationMatrix->get(2), mAnimationMatrix->get(3), - mAnimationMatrix->get(4), mAnimationMatrix->get(5), - mAnimationMatrix->get(6), mAnimationMatrix->get(7), - mAnimationMatrix->get(8)); - renderer.concatMatrix(mAnimationMatrix); - } - if (mMatrixFlags != 0) { - if (mMatrixFlags == TRANSLATION) { - DISPLAY_LIST_LOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY); - renderer.translate(mTranslationX, mTranslationY); - } else { - DISPLAY_LIST_LOGD( - "%s%s %p: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", - indent, "ConcatMatrix", mTransformMatrix, - mTransformMatrix->get(0), mTransformMatrix->get(1), - mTransformMatrix->get(2), mTransformMatrix->get(3), - mTransformMatrix->get(4), mTransformMatrix->get(5), - mTransformMatrix->get(6), mTransformMatrix->get(7), - mTransformMatrix->get(8)); - renderer.concatMatrix(mTransformMatrix); - } + indent, "ConcatMatrix", mTransformMatrix, + mTransformMatrix->get(0), mTransformMatrix->get(1), + mTransformMatrix->get(2), mTransformMatrix->get(3), + mTransformMatrix->get(4), mTransformMatrix->get(5), + mTransformMatrix->get(6), mTransformMatrix->get(7), + mTransformMatrix->get(8)); + renderer.concatMatrix(mTransformMatrix); } - if (mAlpha < 1 && !mCaching) { - if (!mHasOverlappingRendering) { - DISPLAY_LIST_LOGD("%s%s %.2f", indent, "SetAlpha", mAlpha); - renderer.setAlpha(mAlpha); - } else { - // TODO: should be able to store the size of a DL at record time and not - // have to pass it into this call. In fact, this information might be in the - // location/size info that we store with the new native transform data. - int flags = SkCanvas::kHasAlphaLayer_SaveFlag; - if (mClipChildren) { - flags |= SkCanvas::kClipToLayer_SaveFlag; - } - DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha", - (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop, - mMultipliedAlpha, flags); - renderer.saveLayerAlpha(0, 0, mRight - mLeft, mBottom - mTop, - mMultipliedAlpha, flags); + } + if (mAlpha < 1 && !mCaching) { + if (!mHasOverlappingRendering) { + DISPLAY_LIST_LOGD("%s%s %.2f", indent, "SetAlpha", mAlpha); + renderer.setAlpha(mAlpha); + } else { + // TODO: should be able to store the size of a DL at record time and not + // have to pass it into this call. In fact, this information might be in the + // location/size info that we store with the new native transform data. + int flags = SkCanvas::kHasAlphaLayer_SaveFlag; + if (mClipChildren) { + flags |= SkCanvas::kClipToLayer_SaveFlag; } + DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha", + (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop, + mMultipliedAlpha, flags); + renderer.saveLayerAlpha(0, 0, mRight - mLeft, mBottom - mTop, + mMultipliedAlpha, flags); } - if (mClipChildren) { - DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f, - (float) mRight - mLeft, (float) mBottom - mTop); - renderer.clipRect(0, 0, mRight - mLeft, mBottom - mTop, - SkRegion::kIntersect_Op); - } + } + if (mClipChildren) { + DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f, + (float) mRight - mLeft, (float) mBottom - mTop); + renderer.clipRect(0, 0, mRight - mLeft, mBottom - mTop, + SkRegion::kIntersect_Op); } } @@ -805,8 +797,7 @@ void DisplayList::setViewProperties(OpenGLRenderer& renderer, uint32_t width, ui * in the output() function, since that function processes the same list of opcodes for the * purposes of logging display list info for a given view. */ -status_t DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, - uint32_t height, Rect& dirty, int32_t flags, uint32_t level) { +status_t DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flags, uint32_t level) { status_t drawGlStatus = 0; TextContainer text; mReader.rewind(); @@ -825,14 +816,11 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, #endif renderer.startMark(mName.string()); - int restoreTo = 0; - if (USE_DISPLAY_LIST_PROPERTIES) { - DISPLAY_LIST_LOGD("%s%s %d", indent, "Save", - SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); - restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); - } - setViewProperties(renderer, width, height, level); - if (USE_DISPLAY_LIST_PROPERTIES && renderer.quickReject(0, 0, width, height)) { + int restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); + DISPLAY_LIST_LOGD("%s%s %d %d", indent, "Save", + SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag, restoreTo); + setViewProperties(renderer, level); + if (renderer.quickReject(0, 0, mWidth, mHeight)) { DISPLAY_LIST_LOGD("%s%s %d", (char*) indent, "RestoreToCount", restoreTo); renderer.restoreToCount(restoreTo); renderer.endMark(); @@ -963,13 +951,10 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, break; case DrawDisplayList: { DisplayList* displayList = getDisplayList(); - uint32_t width = getUInt(); - uint32_t height = getUInt(); int32_t flags = getInt(); DISPLAY_LIST_LOGD("%s%s %p, %dx%d, 0x%x %d", (char*) indent, OP_NAMES[op], - displayList, width, height, flags, level + 1); - drawGlStatus |= renderer.drawDisplayList(displayList, width, - height, dirty, flags, level + 1); + displayList, mWidth, mHeight, flags, level + 1); + drawGlStatus |= renderer.drawDisplayList(displayList, dirty, flags, level + 1); } break; case DrawLayer: { @@ -1247,10 +1232,8 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, uint32_t width, } } - if (USE_DISPLAY_LIST_PROPERTIES) { - DISPLAY_LIST_LOGD("%s%s %d", (char*) indent, "RestoreToCount", restoreTo); - renderer.restoreToCount(restoreTo); - } + DISPLAY_LIST_LOGD("%s%s %d", (char*) indent, "RestoreToCount", restoreTo); + renderer.restoreToCount(restoreTo); renderer.endMark(); DISPLAY_LIST_LOGD("%sDone (%p, %s), returning %d", (char*) indent + 2, this, mName.string(), @@ -1437,13 +1420,12 @@ bool DisplayListRenderer::clipRect(float left, float top, float right, float bot } status_t DisplayListRenderer::drawDisplayList(DisplayList* displayList, - uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level) { + Rect& dirty, int32_t flags, uint32_t level) { // dirty is an out parameter and should not be recorded, // it matters only when replaying the display list addOp(DisplayList::DrawDisplayList); addDisplayList(displayList); - addSize(width, height); addInt(flags); return DrawGlInfo::kStatusDone; } diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index fe0c94d..a7fc23a 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -49,10 +49,6 @@ namespace uirenderer { #define DISPLAY_LIST_LOGD(...) #endif -// Set to 1 to enable native processing of View properties. 0 by default. Eventually this -// will go away and we will always use this approach for accelerated apps. -#define USE_DISPLAY_LIST_PROPERTIES 1 - #define TRANSLATION 0x0001 #define ROTATION 0x0002 #define ROTATION_3D 0x0004 @@ -127,8 +123,7 @@ public: static const char* OP_NAMES[]; - void setViewProperties(OpenGLRenderer& renderer, uint32_t width, uint32_t height, - uint32_t level); + void setViewProperties(OpenGLRenderer& renderer, uint32_t level); void outputViewProperties(OpenGLRenderer& renderer, char* indent); ANDROID_API size_t getSize(); @@ -137,8 +132,7 @@ public: void initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing = false); - status_t replay(OpenGLRenderer& renderer, uint32_t width, uint32_t height, - Rect& dirty, int32_t flags, uint32_t level = 0); + status_t replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flags, uint32_t level = 0); void output(OpenGLRenderer& renderer, uint32_t level = 0); @@ -393,6 +387,14 @@ public: mCaching = caching; } + int getWidth() { + return mWidth; + } + + int getHeight() { + return mHeight; + } + private: void init(); @@ -563,8 +565,8 @@ public: virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op); - virtual status_t drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, - Rect& dirty, int32_t flags, uint32_t level = 0); + virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t flags, + uint32_t level = 0); virtual void drawLayer(Layer* layer, float x, float y, SkPaint* paint); virtual void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint); virtual void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index ebb8eb7..5edaa46 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1372,17 +1372,13 @@ void OpenGLRenderer::finishDrawTexture() { // Drawing /////////////////////////////////////////////////////////////////////////////// -status_t OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, +status_t OpenGLRenderer::drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t flags, uint32_t level) { - if (!USE_DISPLAY_LIST_PROPERTIES && quickReject(0, 0, width, height)) { - return false; - } - // All the usual checks and setup operations (quickReject, setupDraw, etc.) // will be performed by the display list itself if (displayList && displayList->isRenderable()) { - return displayList->replay(*this, width, height, dirty, flags, level); + return displayList->replay(*this, dirty, flags, level); } return DrawGlInfo::kStatusDone; @@ -2463,8 +2459,7 @@ void OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) { interrupt(); renderer->setViewport(layer->layer.getWidth(), layer->layer.getHeight()); renderer->prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, !layer->isBlend()); - renderer->drawDisplayList(layer->displayList, layer->getWidth(), layer->getHeight(), - dirty, DisplayList::kReplayFlag_ClipChildren); + renderer->drawDisplayList(layer->displayList, dirty, DisplayList::kReplayFlag_ClipChildren); renderer->finish(); resume(); diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 47927bb..141e22b 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -103,8 +103,8 @@ public: virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op); virtual Rect* getClipRect(); - virtual status_t drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, - Rect& dirty, int32_t flags, uint32_t level = 0); + virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t flags, + uint32_t level = 0); virtual void outputDisplayList(DisplayList* displayList, uint32_t level = 0); virtual void drawLayer(Layer* layer, float x, float y, SkPaint* paint); virtual void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint); |