Loading core/java/android/view/GLES20RecordingCanvas.java +6 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; import android.annotation.NonNull; import android.annotation.Nullable; import android.util.Pools.SynchronizedPool; /** Loading @@ -41,7 +42,6 @@ class GLES20RecordingCanvas extends GLES20Canvas { static GLES20RecordingCanvas obtain(@NonNull RenderNode node) { if (node == null) throw new IllegalArgumentException("node cannot be null"); GLES20RecordingCanvas canvas = sPool.acquire(); if (canvas == null) { canvas = new GLES20RecordingCanvas(); Loading @@ -58,4 +58,9 @@ class GLES20RecordingCanvas extends GLES20Canvas { long finishRecording() { return nFinishRecording(mRenderer); } @Override public boolean isRecordingFor(Object o) { return o == mNode; } } core/java/android/view/RenderNode.java +17 −55 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ package android.view; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Matrix; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.Rect; /** * <p>A display list records a series of graphics related operations and can replay Loading Loading @@ -294,13 +296,6 @@ public class RenderNode { // RenderProperty Setters /////////////////////////////////////////////////////////////////////////// /** * Set the caching property on the display list, which indicates whether the display list * holds a layer. Layer display lists should avoid creating an alpha layer, since alpha is * handled in the drawLayer operation directly (and more efficiently). * * @param caching true if the display list represents a hardware layer, false otherwise. */ public boolean setLayerType(int layerType) { return nSetLayerType(mNativeRenderNode, layerType); } Loading @@ -309,6 +304,14 @@ public class RenderNode { return nSetLayerPaint(mNativeRenderNode, paint != null ? paint.mNativePaint : 0); } public boolean setClipBounds(@Nullable Rect rect) { if (rect == null) { return nSetClipBoundsEmpty(mNativeRenderNode); } else { return nSetClipBounds(mNativeRenderNode, rect.left, rect.top, rect.right, rect.bottom); } } /** * Set whether the Render node should clip itself to its bounds. This property is controlled by * the view's parent. Loading Loading @@ -702,84 +705,44 @@ public class RenderNode { * @param left The left position, in pixels, of the display list * * @see View#setLeft(int) * @see #getLeft() */ public boolean setLeft(int left) { return nSetLeft(mNativeRenderNode, left); } /** * Returns the left position for the display list in pixels. * * @see #setLeft(int) */ public float getLeft() { return nGetLeft(mNativeRenderNode); } /** * Sets the top position for the display list. * * @param top The top position, in pixels, of the display list * * @see View#setTop(int) * @see #getTop() */ public boolean setTop(int top) { return nSetTop(mNativeRenderNode, top); } /** * Returns the top position for the display list in pixels. * * @see #setTop(int) */ public float getTop() { return nGetTop(mNativeRenderNode); } /** * Sets the right position for the display list. * * @param right The right position, in pixels, of the display list * * @see View#setRight(int) * @see #getRight() */ public boolean setRight(int right) { return nSetRight(mNativeRenderNode, right); } /** * Returns the right position for the display list in pixels. * * @see #setRight(int) */ public float getRight() { return nGetRight(mNativeRenderNode); } /** * Sets the bottom position for the display list. * * @param bottom The bottom position, in pixels, of the display list * * @see View#setBottom(int) * @see #getBottom() */ public boolean setBottom(int bottom) { return nSetBottom(mNativeRenderNode, bottom); } /** * Returns the bottom position for the display list in pixels. * * @see #setBottom(int) */ public float getBottom() { return nGetBottom(mNativeRenderNode); } /** * Sets the left and top positions for the display list * Loading @@ -805,7 +768,7 @@ public class RenderNode { * * @see View#offsetLeftAndRight(int) */ public boolean offsetLeftAndRight(float offset) { public boolean offsetLeftAndRight(int offset) { return nOffsetLeftAndRight(mNativeRenderNode, offset); } Loading @@ -817,7 +780,7 @@ public class RenderNode { * * @see View#offsetTopAndBottom(int) */ public boolean offsetTopAndBottom(float offset) { public boolean offsetTopAndBottom(int offset) { return nOffsetTopAndBottom(mNativeRenderNode, offset); } Loading Loading @@ -860,8 +823,8 @@ public class RenderNode { // Properties private static native boolean nOffsetTopAndBottom(long renderNode, float offset); private static native boolean nOffsetLeftAndRight(long renderNode, float offset); private static native boolean nOffsetTopAndBottom(long renderNode, int offset); private static native boolean nOffsetLeftAndRight(long renderNode, int offset); private static native boolean nSetLeftTopRightBottom(long renderNode, int left, int top, int right, int bottom); private static native boolean nSetBottom(long renderNode, int bottom); Loading @@ -874,6 +837,9 @@ public class RenderNode { private static native boolean nSetLayerType(long renderNode, int layerType); private static native boolean nSetLayerPaint(long renderNode, long paint); private static native boolean nSetClipToBounds(long renderNode, boolean clipToBounds); private static native boolean nSetClipBounds(long renderNode, int left, int top, int right, int bottom); private static native boolean nSetClipBoundsEmpty(long renderNode); private static native boolean nSetProjectBackwards(long renderNode, boolean shouldProject); private static native boolean nSetProjectionReceiver(long renderNode, boolean shouldRecieve); private static native boolean nSetOutlineRoundRect(long renderNode, int left, int top, Loading Loading @@ -902,10 +868,6 @@ public class RenderNode { private static native boolean nHasOverlappingRendering(long renderNode); private static native boolean nGetClipToOutline(long renderNode); private static native float nGetAlpha(long renderNode); private static native float nGetLeft(long renderNode); private static native float nGetTop(long renderNode); private static native float nGetRight(long renderNode); private static native float nGetBottom(long renderNode); private static native float nGetCameraDistance(long renderNode); private static native float nGetScaleX(long renderNode); private static native float nGetScaleY(long renderNode); Loading core/java/android/view/View.java +20 −26 Original line number Diff line number Diff line Loading @@ -723,11 +723,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ private static boolean sIgnoreMeasureCache = false; /** * Ignore the clipBounds of this view for the children. */ static boolean sIgnoreClipBoundsForChildren = false; /** * This view does not want keystrokes. Use with TAKES_FOCUS_MASK when * calling setFlags. Loading Loading @@ -3558,9 +3553,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // of whether a layout was requested on that View. sIgnoreMeasureCache = targetSdkVersion < KITKAT; // Older apps may need this to ignore the clip bounds sIgnoreClipBoundsForChildren = targetSdkVersion < L; sCompatibilityDone = true; } } Loading Loading @@ -14309,6 +14301,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mClipBounds = null; } } mRenderNode.setClipBounds(mClipBounds); } /** Loading Loading @@ -14430,7 +14423,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * to be called from anywhere else other than ViewGroup.drawChild(). */ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { boolean useDisplayListProperties = mAttachInfo != null && mAttachInfo.mHardwareAccelerated; boolean usingRenderNodeProperties = mAttachInfo != null && mAttachInfo.mHardwareAccelerated; boolean more = false; final boolean childHasIdentityMatrix = hasIdentityMatrix(); final int flags = parent.mGroupFlags; Loading Loading @@ -14471,7 +14464,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mRenderNode.setAnimationMatrix(null); mPrivateFlags3 &= ~PFLAG3_VIEW_IS_ANIMATING_TRANSFORM; } if (!useDisplayListProperties && if (!usingRenderNodeProperties && (flags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) { final Transformation t = parent.getChildTransformation(); final boolean hasTransform = parent.getChildStaticTransformation(this, t); Loading Loading @@ -14519,7 +14512,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } else { switch (layerType) { case LAYER_TYPE_SOFTWARE: if (useDisplayListProperties) { if (usingRenderNodeProperties) { hasDisplayList = canHaveDisplayList(); } else { buildDrawingCache(true); Loading @@ -14527,7 +14520,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } break; case LAYER_TYPE_HARDWARE: if (useDisplayListProperties) { if (usingRenderNodeProperties) { hasDisplayList = canHaveDisplayList(); } break; Loading @@ -14539,8 +14532,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } } useDisplayListProperties &= hasDisplayList; if (useDisplayListProperties) { usingRenderNodeProperties &= hasDisplayList; if (usingRenderNodeProperties) { renderNode = getDisplayList(); if (!renderNode.isValid()) { // Uncommon, but possible. If a view is removed from the hierarchy during the call Loading @@ -14548,7 +14541,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // try to use it again. renderNode = null; hasDisplayList = false; useDisplayListProperties = false; usingRenderNodeProperties = false; } } Loading @@ -14565,17 +14558,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback, layerType != LAYER_TYPE_HARDWARE; int restoreTo = -1; if (!useDisplayListProperties || transformToApply != null) { if (!usingRenderNodeProperties || transformToApply != null) { restoreTo = canvas.save(); } if (offsetForScroll) { canvas.translate(mLeft - sx, mTop - sy); } else { if (!useDisplayListProperties) { if (!usingRenderNodeProperties) { canvas.translate(mLeft, mTop); } if (scalingRequired) { if (useDisplayListProperties) { if (usingRenderNodeProperties) { // TODO: Might not need this if we put everything inside the DL restoreTo = canvas.save(); } Loading @@ -14585,7 +14578,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } float alpha = useDisplayListProperties ? 1 : (getAlpha() * getTransitionAlpha()); float alpha = usingRenderNodeProperties ? 1 : (getAlpha() * getTransitionAlpha()); if (transformToApply != null || alpha < 1 || !hasIdentityMatrix() || (mPrivateFlags3 & PFLAG3_VIEW_IS_ANIMATING_ALPHA) == PFLAG3_VIEW_IS_ANIMATING_ALPHA) { if (transformToApply != null || !childHasIdentityMatrix) { Loading @@ -14599,7 +14592,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (transformToApply != null) { if (concatMatrix) { if (useDisplayListProperties) { if (usingRenderNodeProperties) { renderNode.setAnimationMatrix(transformToApply.getMatrix()); } else { // Undo the scroll translation, apply the transformation matrix, Loading @@ -14618,7 +14611,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } if (!childHasIdentityMatrix && !useDisplayListProperties) { if (!childHasIdentityMatrix && !usingRenderNodeProperties) { canvas.translate(-transX, -transY); canvas.concat(getMatrix()); canvas.translate(transX, transY); Loading @@ -14642,7 +14635,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, layerType != LAYER_TYPE_NONE) { layerFlags |= Canvas.CLIP_TO_LAYER_SAVE_FLAG; } if (useDisplayListProperties) { if (usingRenderNodeProperties) { renderNode.setAlpha(alpha * getAlpha() * getTransitionAlpha()); } else if (layerType == LAYER_TYPE_NONE) { final int scrollX = hasDisplayList ? 0 : sx; Loading @@ -14662,7 +14655,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } if ((flags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN && !useDisplayListProperties && cache == null) { !usingRenderNodeProperties && cache == null) { if (offsetForScroll) { canvas.clipRect(sx, sy, sx + (mRight - mLeft), sy + (mBottom - mTop)); } else { Loading @@ -14674,7 +14667,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } if (!useDisplayListProperties && hasDisplayList) { if (!usingRenderNodeProperties && hasDisplayList) { renderNode = getDisplayList(); if (!renderNode.isValid()) { // Uncommon, but possible. If a view is removed from the hierarchy during the call Loading @@ -14687,7 +14680,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (hasNoCache) { boolean layerRendered = false; if (layerType == LAYER_TYPE_HARDWARE && !useDisplayListProperties) { if (layerType == LAYER_TYPE_HARDWARE && !usingRenderNodeProperties) { final HardwareLayer layer = getHardwareLayer(); if (layer != null && layer.isValid()) { mLayerPaint.setAlpha((int) (alpha * 255)); Loading Loading @@ -14774,7 +14767,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @param canvas The Canvas to which the View is rendered. */ public void draw(Canvas canvas) { if (mClipBounds != null) { boolean usingRenderNodeProperties = canvas.isRecordingFor(mRenderNode); if (mClipBounds != null && !usingRenderNodeProperties) { canvas.clipRect(mClipBounds); } final int privateFlags = mPrivateFlags; core/java/android/view/ViewGroup.java +3 −2 Original line number Diff line number Diff line Loading @@ -3015,6 +3015,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager */ @Override protected void dispatchDraw(Canvas canvas) { boolean usingRenderNodeProperties = canvas.isRecordingFor(mRenderNode); final int childrenCount = mChildrenCount; final View[] children = mChildren; int flags = mGroupFlags; Loading Loading @@ -3059,7 +3060,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager int clipSaveCount = 0; final boolean clipToPadding = (flags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK; boolean hasClipBounds = mClipBounds != null && !sIgnoreClipBoundsForChildren; boolean hasClipBounds = mClipBounds != null && !usingRenderNodeProperties; boolean clippingNeeded = clipToPadding || hasClipBounds; if (clippingNeeded) { Loading Loading @@ -3087,7 +3088,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // Only use the preordered list if not HW accelerated, since the HW pipeline will do the // draw reordering internally final ArrayList<View> preorderedList = canvas.isHardwareAccelerated() final ArrayList<View> preorderedList = usingRenderNodeProperties ? null : buildOrderedChildList(); final boolean customOrder = preorderedList == null && isChildrenDrawingOrderEnabled(); Loading core/jni/android_view_RenderNode.cpp +17 −32 Original line number Diff line number Diff line Loading @@ -117,6 +117,17 @@ static jboolean android_view_RenderNode_setClipToBounds(JNIEnv* env, return SET_AND_DIRTY(setClipToBounds, clipToBounds, RenderNode::GENERIC); } static jboolean android_view_RenderNode_setClipBounds(JNIEnv* env, jobject clazz, jlong renderNodePtr, jint left, jint top, jint right, jint bottom) { android::uirenderer::Rect clipBounds(left, top, right, bottom); return SET_AND_DIRTY(setClipBounds, clipBounds, RenderNode::GENERIC); } static jboolean android_view_RenderNode_setClipBoundsEmpty(JNIEnv* env, jobject clazz, jlong renderNodePtr) { return SET_AND_DIRTY(setClipBoundsEmpty,, RenderNode::GENERIC); } static jboolean android_view_RenderNode_setProjectBackwards(JNIEnv* env, jobject clazz, jlong renderNodePtr, jboolean shouldProject) { return SET_AND_DIRTY(setProjectBackwards, shouldProject, RenderNode::GENERIC); Loading Loading @@ -282,12 +293,12 @@ static jboolean android_view_RenderNode_setLeftTopRightBottom(JNIEnv* env, } static jboolean android_view_RenderNode_offsetLeftAndRight(JNIEnv* env, jobject clazz, jlong renderNodePtr, float offset) { jobject clazz, jlong renderNodePtr, jint offset) { return SET_AND_DIRTY(offsetLeftRight, offset, RenderNode::X); } static jboolean android_view_RenderNode_offsetTopAndBottom(JNIEnv* env, jobject clazz, jlong renderNodePtr, float offset) { jobject clazz, jlong renderNodePtr, jint offset) { return SET_AND_DIRTY(offsetTopBottom, offset, RenderNode::Y); } Loading @@ -313,30 +324,6 @@ static jfloat android_view_RenderNode_getAlpha(JNIEnv* env, return renderNode->stagingProperties().getAlpha(); } static jfloat android_view_RenderNode_getLeft(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getLeft(); } static jfloat android_view_RenderNode_getTop(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getTop(); } static jfloat android_view_RenderNode_getRight(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getRight(); } static jfloat android_view_RenderNode_getBottom(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getBottom(); } static jfloat android_view_RenderNode_getCameraDistance(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); Loading Loading @@ -488,6 +475,8 @@ static JNINativeMethod gMethods[] = { { "nSetStaticMatrix", "(JJ)Z", (void*) android_view_RenderNode_setStaticMatrix }, { "nSetAnimationMatrix", "(JJ)Z", (void*) android_view_RenderNode_setAnimationMatrix }, { "nSetClipToBounds", "(JZ)Z", (void*) android_view_RenderNode_setClipToBounds }, { "nSetClipBounds", "(JIIII)Z", (void*) android_view_RenderNode_setClipBounds }, { "nSetClipBoundsEmpty", "(J)Z", (void*) android_view_RenderNode_setClipBoundsEmpty }, { "nSetProjectBackwards", "(JZ)Z", (void*) android_view_RenderNode_setProjectBackwards }, { "nSetProjectionReceiver","(JZ)Z", (void*) android_view_RenderNode_setProjectionReceiver }, Loading Loading @@ -518,16 +507,12 @@ static JNINativeMethod gMethods[] = { { "nSetRight", "(JI)Z", (void*) android_view_RenderNode_setRight }, { "nSetBottom", "(JI)Z", (void*) android_view_RenderNode_setBottom }, { "nSetLeftTopRightBottom","(JIIII)Z", (void*) android_view_RenderNode_setLeftTopRightBottom }, { "nOffsetLeftAndRight", "(JF)Z", (void*) android_view_RenderNode_offsetLeftAndRight }, { "nOffsetTopAndBottom", "(JF)Z", (void*) android_view_RenderNode_offsetTopAndBottom }, { "nOffsetLeftAndRight", "(JI)Z", (void*) android_view_RenderNode_offsetLeftAndRight }, { "nOffsetTopAndBottom", "(JI)Z", (void*) android_view_RenderNode_offsetTopAndBottom }, { "nHasOverlappingRendering", "(J)Z", (void*) android_view_RenderNode_hasOverlappingRendering }, { "nGetClipToOutline", "(J)Z", (void*) android_view_RenderNode_getClipToOutline }, { "nGetAlpha", "(J)F", (void*) android_view_RenderNode_getAlpha }, { "nGetLeft", "(J)F", (void*) android_view_RenderNode_getLeft }, { "nGetTop", "(J)F", (void*) android_view_RenderNode_getTop }, { "nGetRight", "(J)F", (void*) android_view_RenderNode_getRight }, { "nGetBottom", "(J)F", (void*) android_view_RenderNode_getBottom }, { "nGetCameraDistance", "(J)F", (void*) android_view_RenderNode_getCameraDistance }, { "nGetScaleX", "(J)F", (void*) android_view_RenderNode_getScaleX }, { "nGetScaleY", "(J)F", (void*) android_view_RenderNode_getScaleY }, Loading Loading
core/java/android/view/GLES20RecordingCanvas.java +6 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; import android.annotation.NonNull; import android.annotation.Nullable; import android.util.Pools.SynchronizedPool; /** Loading @@ -41,7 +42,6 @@ class GLES20RecordingCanvas extends GLES20Canvas { static GLES20RecordingCanvas obtain(@NonNull RenderNode node) { if (node == null) throw new IllegalArgumentException("node cannot be null"); GLES20RecordingCanvas canvas = sPool.acquire(); if (canvas == null) { canvas = new GLES20RecordingCanvas(); Loading @@ -58,4 +58,9 @@ class GLES20RecordingCanvas extends GLES20Canvas { long finishRecording() { return nFinishRecording(mRenderer); } @Override public boolean isRecordingFor(Object o) { return o == mNode; } }
core/java/android/view/RenderNode.java +17 −55 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ package android.view; import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Matrix; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.Rect; /** * <p>A display list records a series of graphics related operations and can replay Loading Loading @@ -294,13 +296,6 @@ public class RenderNode { // RenderProperty Setters /////////////////////////////////////////////////////////////////////////// /** * Set the caching property on the display list, which indicates whether the display list * holds a layer. Layer display lists should avoid creating an alpha layer, since alpha is * handled in the drawLayer operation directly (and more efficiently). * * @param caching true if the display list represents a hardware layer, false otherwise. */ public boolean setLayerType(int layerType) { return nSetLayerType(mNativeRenderNode, layerType); } Loading @@ -309,6 +304,14 @@ public class RenderNode { return nSetLayerPaint(mNativeRenderNode, paint != null ? paint.mNativePaint : 0); } public boolean setClipBounds(@Nullable Rect rect) { if (rect == null) { return nSetClipBoundsEmpty(mNativeRenderNode); } else { return nSetClipBounds(mNativeRenderNode, rect.left, rect.top, rect.right, rect.bottom); } } /** * Set whether the Render node should clip itself to its bounds. This property is controlled by * the view's parent. Loading Loading @@ -702,84 +705,44 @@ public class RenderNode { * @param left The left position, in pixels, of the display list * * @see View#setLeft(int) * @see #getLeft() */ public boolean setLeft(int left) { return nSetLeft(mNativeRenderNode, left); } /** * Returns the left position for the display list in pixels. * * @see #setLeft(int) */ public float getLeft() { return nGetLeft(mNativeRenderNode); } /** * Sets the top position for the display list. * * @param top The top position, in pixels, of the display list * * @see View#setTop(int) * @see #getTop() */ public boolean setTop(int top) { return nSetTop(mNativeRenderNode, top); } /** * Returns the top position for the display list in pixels. * * @see #setTop(int) */ public float getTop() { return nGetTop(mNativeRenderNode); } /** * Sets the right position for the display list. * * @param right The right position, in pixels, of the display list * * @see View#setRight(int) * @see #getRight() */ public boolean setRight(int right) { return nSetRight(mNativeRenderNode, right); } /** * Returns the right position for the display list in pixels. * * @see #setRight(int) */ public float getRight() { return nGetRight(mNativeRenderNode); } /** * Sets the bottom position for the display list. * * @param bottom The bottom position, in pixels, of the display list * * @see View#setBottom(int) * @see #getBottom() */ public boolean setBottom(int bottom) { return nSetBottom(mNativeRenderNode, bottom); } /** * Returns the bottom position for the display list in pixels. * * @see #setBottom(int) */ public float getBottom() { return nGetBottom(mNativeRenderNode); } /** * Sets the left and top positions for the display list * Loading @@ -805,7 +768,7 @@ public class RenderNode { * * @see View#offsetLeftAndRight(int) */ public boolean offsetLeftAndRight(float offset) { public boolean offsetLeftAndRight(int offset) { return nOffsetLeftAndRight(mNativeRenderNode, offset); } Loading @@ -817,7 +780,7 @@ public class RenderNode { * * @see View#offsetTopAndBottom(int) */ public boolean offsetTopAndBottom(float offset) { public boolean offsetTopAndBottom(int offset) { return nOffsetTopAndBottom(mNativeRenderNode, offset); } Loading Loading @@ -860,8 +823,8 @@ public class RenderNode { // Properties private static native boolean nOffsetTopAndBottom(long renderNode, float offset); private static native boolean nOffsetLeftAndRight(long renderNode, float offset); private static native boolean nOffsetTopAndBottom(long renderNode, int offset); private static native boolean nOffsetLeftAndRight(long renderNode, int offset); private static native boolean nSetLeftTopRightBottom(long renderNode, int left, int top, int right, int bottom); private static native boolean nSetBottom(long renderNode, int bottom); Loading @@ -874,6 +837,9 @@ public class RenderNode { private static native boolean nSetLayerType(long renderNode, int layerType); private static native boolean nSetLayerPaint(long renderNode, long paint); private static native boolean nSetClipToBounds(long renderNode, boolean clipToBounds); private static native boolean nSetClipBounds(long renderNode, int left, int top, int right, int bottom); private static native boolean nSetClipBoundsEmpty(long renderNode); private static native boolean nSetProjectBackwards(long renderNode, boolean shouldProject); private static native boolean nSetProjectionReceiver(long renderNode, boolean shouldRecieve); private static native boolean nSetOutlineRoundRect(long renderNode, int left, int top, Loading Loading @@ -902,10 +868,6 @@ public class RenderNode { private static native boolean nHasOverlappingRendering(long renderNode); private static native boolean nGetClipToOutline(long renderNode); private static native float nGetAlpha(long renderNode); private static native float nGetLeft(long renderNode); private static native float nGetTop(long renderNode); private static native float nGetRight(long renderNode); private static native float nGetBottom(long renderNode); private static native float nGetCameraDistance(long renderNode); private static native float nGetScaleX(long renderNode); private static native float nGetScaleY(long renderNode); Loading
core/java/android/view/View.java +20 −26 Original line number Diff line number Diff line Loading @@ -723,11 +723,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ private static boolean sIgnoreMeasureCache = false; /** * Ignore the clipBounds of this view for the children. */ static boolean sIgnoreClipBoundsForChildren = false; /** * This view does not want keystrokes. Use with TAKES_FOCUS_MASK when * calling setFlags. Loading Loading @@ -3558,9 +3553,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // of whether a layout was requested on that View. sIgnoreMeasureCache = targetSdkVersion < KITKAT; // Older apps may need this to ignore the clip bounds sIgnoreClipBoundsForChildren = targetSdkVersion < L; sCompatibilityDone = true; } } Loading Loading @@ -14309,6 +14301,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mClipBounds = null; } } mRenderNode.setClipBounds(mClipBounds); } /** Loading Loading @@ -14430,7 +14423,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * to be called from anywhere else other than ViewGroup.drawChild(). */ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) { boolean useDisplayListProperties = mAttachInfo != null && mAttachInfo.mHardwareAccelerated; boolean usingRenderNodeProperties = mAttachInfo != null && mAttachInfo.mHardwareAccelerated; boolean more = false; final boolean childHasIdentityMatrix = hasIdentityMatrix(); final int flags = parent.mGroupFlags; Loading Loading @@ -14471,7 +14464,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, mRenderNode.setAnimationMatrix(null); mPrivateFlags3 &= ~PFLAG3_VIEW_IS_ANIMATING_TRANSFORM; } if (!useDisplayListProperties && if (!usingRenderNodeProperties && (flags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) { final Transformation t = parent.getChildTransformation(); final boolean hasTransform = parent.getChildStaticTransformation(this, t); Loading Loading @@ -14519,7 +14512,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } else { switch (layerType) { case LAYER_TYPE_SOFTWARE: if (useDisplayListProperties) { if (usingRenderNodeProperties) { hasDisplayList = canHaveDisplayList(); } else { buildDrawingCache(true); Loading @@ -14527,7 +14520,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } break; case LAYER_TYPE_HARDWARE: if (useDisplayListProperties) { if (usingRenderNodeProperties) { hasDisplayList = canHaveDisplayList(); } break; Loading @@ -14539,8 +14532,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } } useDisplayListProperties &= hasDisplayList; if (useDisplayListProperties) { usingRenderNodeProperties &= hasDisplayList; if (usingRenderNodeProperties) { renderNode = getDisplayList(); if (!renderNode.isValid()) { // Uncommon, but possible. If a view is removed from the hierarchy during the call Loading @@ -14548,7 +14541,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // try to use it again. renderNode = null; hasDisplayList = false; useDisplayListProperties = false; usingRenderNodeProperties = false; } } Loading @@ -14565,17 +14558,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback, layerType != LAYER_TYPE_HARDWARE; int restoreTo = -1; if (!useDisplayListProperties || transformToApply != null) { if (!usingRenderNodeProperties || transformToApply != null) { restoreTo = canvas.save(); } if (offsetForScroll) { canvas.translate(mLeft - sx, mTop - sy); } else { if (!useDisplayListProperties) { if (!usingRenderNodeProperties) { canvas.translate(mLeft, mTop); } if (scalingRequired) { if (useDisplayListProperties) { if (usingRenderNodeProperties) { // TODO: Might not need this if we put everything inside the DL restoreTo = canvas.save(); } Loading @@ -14585,7 +14578,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } float alpha = useDisplayListProperties ? 1 : (getAlpha() * getTransitionAlpha()); float alpha = usingRenderNodeProperties ? 1 : (getAlpha() * getTransitionAlpha()); if (transformToApply != null || alpha < 1 || !hasIdentityMatrix() || (mPrivateFlags3 & PFLAG3_VIEW_IS_ANIMATING_ALPHA) == PFLAG3_VIEW_IS_ANIMATING_ALPHA) { if (transformToApply != null || !childHasIdentityMatrix) { Loading @@ -14599,7 +14592,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (transformToApply != null) { if (concatMatrix) { if (useDisplayListProperties) { if (usingRenderNodeProperties) { renderNode.setAnimationMatrix(transformToApply.getMatrix()); } else { // Undo the scroll translation, apply the transformation matrix, Loading @@ -14618,7 +14611,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } if (!childHasIdentityMatrix && !useDisplayListProperties) { if (!childHasIdentityMatrix && !usingRenderNodeProperties) { canvas.translate(-transX, -transY); canvas.concat(getMatrix()); canvas.translate(transX, transY); Loading @@ -14642,7 +14635,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, layerType != LAYER_TYPE_NONE) { layerFlags |= Canvas.CLIP_TO_LAYER_SAVE_FLAG; } if (useDisplayListProperties) { if (usingRenderNodeProperties) { renderNode.setAlpha(alpha * getAlpha() * getTransitionAlpha()); } else if (layerType == LAYER_TYPE_NONE) { final int scrollX = hasDisplayList ? 0 : sx; Loading @@ -14662,7 +14655,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } if ((flags & ViewGroup.FLAG_CLIP_CHILDREN) == ViewGroup.FLAG_CLIP_CHILDREN && !useDisplayListProperties && cache == null) { !usingRenderNodeProperties && cache == null) { if (offsetForScroll) { canvas.clipRect(sx, sy, sx + (mRight - mLeft), sy + (mBottom - mTop)); } else { Loading @@ -14674,7 +14667,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } if (!useDisplayListProperties && hasDisplayList) { if (!usingRenderNodeProperties && hasDisplayList) { renderNode = getDisplayList(); if (!renderNode.isValid()) { // Uncommon, but possible. If a view is removed from the hierarchy during the call Loading @@ -14687,7 +14680,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (hasNoCache) { boolean layerRendered = false; if (layerType == LAYER_TYPE_HARDWARE && !useDisplayListProperties) { if (layerType == LAYER_TYPE_HARDWARE && !usingRenderNodeProperties) { final HardwareLayer layer = getHardwareLayer(); if (layer != null && layer.isValid()) { mLayerPaint.setAlpha((int) (alpha * 255)); Loading Loading @@ -14774,7 +14767,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @param canvas The Canvas to which the View is rendered. */ public void draw(Canvas canvas) { if (mClipBounds != null) { boolean usingRenderNodeProperties = canvas.isRecordingFor(mRenderNode); if (mClipBounds != null && !usingRenderNodeProperties) { canvas.clipRect(mClipBounds); } final int privateFlags = mPrivateFlags;
core/java/android/view/ViewGroup.java +3 −2 Original line number Diff line number Diff line Loading @@ -3015,6 +3015,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager */ @Override protected void dispatchDraw(Canvas canvas) { boolean usingRenderNodeProperties = canvas.isRecordingFor(mRenderNode); final int childrenCount = mChildrenCount; final View[] children = mChildren; int flags = mGroupFlags; Loading Loading @@ -3059,7 +3060,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager int clipSaveCount = 0; final boolean clipToPadding = (flags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK; boolean hasClipBounds = mClipBounds != null && !sIgnoreClipBoundsForChildren; boolean hasClipBounds = mClipBounds != null && !usingRenderNodeProperties; boolean clippingNeeded = clipToPadding || hasClipBounds; if (clippingNeeded) { Loading Loading @@ -3087,7 +3088,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // Only use the preordered list if not HW accelerated, since the HW pipeline will do the // draw reordering internally final ArrayList<View> preorderedList = canvas.isHardwareAccelerated() final ArrayList<View> preorderedList = usingRenderNodeProperties ? null : buildOrderedChildList(); final boolean customOrder = preorderedList == null && isChildrenDrawingOrderEnabled(); Loading
core/jni/android_view_RenderNode.cpp +17 −32 Original line number Diff line number Diff line Loading @@ -117,6 +117,17 @@ static jboolean android_view_RenderNode_setClipToBounds(JNIEnv* env, return SET_AND_DIRTY(setClipToBounds, clipToBounds, RenderNode::GENERIC); } static jboolean android_view_RenderNode_setClipBounds(JNIEnv* env, jobject clazz, jlong renderNodePtr, jint left, jint top, jint right, jint bottom) { android::uirenderer::Rect clipBounds(left, top, right, bottom); return SET_AND_DIRTY(setClipBounds, clipBounds, RenderNode::GENERIC); } static jboolean android_view_RenderNode_setClipBoundsEmpty(JNIEnv* env, jobject clazz, jlong renderNodePtr) { return SET_AND_DIRTY(setClipBoundsEmpty,, RenderNode::GENERIC); } static jboolean android_view_RenderNode_setProjectBackwards(JNIEnv* env, jobject clazz, jlong renderNodePtr, jboolean shouldProject) { return SET_AND_DIRTY(setProjectBackwards, shouldProject, RenderNode::GENERIC); Loading Loading @@ -282,12 +293,12 @@ static jboolean android_view_RenderNode_setLeftTopRightBottom(JNIEnv* env, } static jboolean android_view_RenderNode_offsetLeftAndRight(JNIEnv* env, jobject clazz, jlong renderNodePtr, float offset) { jobject clazz, jlong renderNodePtr, jint offset) { return SET_AND_DIRTY(offsetLeftRight, offset, RenderNode::X); } static jboolean android_view_RenderNode_offsetTopAndBottom(JNIEnv* env, jobject clazz, jlong renderNodePtr, float offset) { jobject clazz, jlong renderNodePtr, jint offset) { return SET_AND_DIRTY(offsetTopBottom, offset, RenderNode::Y); } Loading @@ -313,30 +324,6 @@ static jfloat android_view_RenderNode_getAlpha(JNIEnv* env, return renderNode->stagingProperties().getAlpha(); } static jfloat android_view_RenderNode_getLeft(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getLeft(); } static jfloat android_view_RenderNode_getTop(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getTop(); } static jfloat android_view_RenderNode_getRight(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getRight(); } static jfloat android_view_RenderNode_getBottom(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); return renderNode->stagingProperties().getBottom(); } static jfloat android_view_RenderNode_getCameraDistance(JNIEnv* env, jobject clazz, jlong renderNodePtr) { RenderNode* renderNode = reinterpret_cast<RenderNode*>(renderNodePtr); Loading Loading @@ -488,6 +475,8 @@ static JNINativeMethod gMethods[] = { { "nSetStaticMatrix", "(JJ)Z", (void*) android_view_RenderNode_setStaticMatrix }, { "nSetAnimationMatrix", "(JJ)Z", (void*) android_view_RenderNode_setAnimationMatrix }, { "nSetClipToBounds", "(JZ)Z", (void*) android_view_RenderNode_setClipToBounds }, { "nSetClipBounds", "(JIIII)Z", (void*) android_view_RenderNode_setClipBounds }, { "nSetClipBoundsEmpty", "(J)Z", (void*) android_view_RenderNode_setClipBoundsEmpty }, { "nSetProjectBackwards", "(JZ)Z", (void*) android_view_RenderNode_setProjectBackwards }, { "nSetProjectionReceiver","(JZ)Z", (void*) android_view_RenderNode_setProjectionReceiver }, Loading Loading @@ -518,16 +507,12 @@ static JNINativeMethod gMethods[] = { { "nSetRight", "(JI)Z", (void*) android_view_RenderNode_setRight }, { "nSetBottom", "(JI)Z", (void*) android_view_RenderNode_setBottom }, { "nSetLeftTopRightBottom","(JIIII)Z", (void*) android_view_RenderNode_setLeftTopRightBottom }, { "nOffsetLeftAndRight", "(JF)Z", (void*) android_view_RenderNode_offsetLeftAndRight }, { "nOffsetTopAndBottom", "(JF)Z", (void*) android_view_RenderNode_offsetTopAndBottom }, { "nOffsetLeftAndRight", "(JI)Z", (void*) android_view_RenderNode_offsetLeftAndRight }, { "nOffsetTopAndBottom", "(JI)Z", (void*) android_view_RenderNode_offsetTopAndBottom }, { "nHasOverlappingRendering", "(J)Z", (void*) android_view_RenderNode_hasOverlappingRendering }, { "nGetClipToOutline", "(J)Z", (void*) android_view_RenderNode_getClipToOutline }, { "nGetAlpha", "(J)F", (void*) android_view_RenderNode_getAlpha }, { "nGetLeft", "(J)F", (void*) android_view_RenderNode_getLeft }, { "nGetTop", "(J)F", (void*) android_view_RenderNode_getTop }, { "nGetRight", "(J)F", (void*) android_view_RenderNode_getRight }, { "nGetBottom", "(J)F", (void*) android_view_RenderNode_getBottom }, { "nGetCameraDistance", "(J)F", (void*) android_view_RenderNode_getCameraDistance }, { "nGetScaleX", "(J)F", (void*) android_view_RenderNode_getScaleX }, { "nGetScaleY", "(J)F", (void*) android_view_RenderNode_getScaleY }, Loading