@@ -2829,19 +2829,6 @@ static class ListenerInfo {
28292829 */
28302830 private boolean mSendingHoverAccessibilityEvents;
28312831
2832- /**
2833- * Delegate for injecting accessiblity functionality.
2834- */
2835- AccessibilityDelegate mAccessibilityDelegate;
2836-
2837- /**
2838- * Consistency verifier for debugging purposes.
2839- * @hide
2840- */
2841- protected final InputEventConsistencyVerifier mInputEventConsistencyVerifier =
2842- InputEventConsistencyVerifier.isInstrumentationEnabled() ?
2843- new InputEventConsistencyVerifier(this, 0) : null;
2844-
28452832 /**
28462833 * Simple constructor to use when creating a view from code.
28472834 *
@@ -2862,6 +2849,19 @@ public View(Context context) {
28622849 mUserPaddingRelative = false;
28632850 }
28642851
2852+ /**
2853+ * Delegate for injecting accessiblity functionality.
2854+ */
2855+ AccessibilityDelegate mAccessibilityDelegate;
2856+
2857+ /**
2858+ * Consistency verifier for debugging purposes.
2859+ * @hide
2860+ */
2861+ protected final InputEventConsistencyVerifier mInputEventConsistencyVerifier =
2862+ InputEventConsistencyVerifier.isInstrumentationEnabled() ?
2863+ new InputEventConsistencyVerifier(this, 0) : null;
2864+
28652865 /**
28662866 * Constructor that is called when inflating a view from XML. This is called
28672867 * when a view is being constructed from an XML file, supplying attributes
@@ -7854,6 +7854,23 @@ public float getAlpha() {
78547854 return mTransformationInfo != null ? mTransformationInfo.mAlpha : 1;
78557855 }
78567856
7857+ /**
7858+ * Returns whether this View has content which overlaps. This function, intended to be
7859+ * overridden by specific View types, is an optimization when alpha is set on a view. If
7860+ * rendering overlaps in a view with alpha < 1, that view is drawn to an offscreen buffer
7861+ * and then composited it into place, which can be expensive. If the view has no overlapping
7862+ * rendering, the view can draw each primitive with the appropriate alpha value directly.
7863+ * An example of overlapping rendering is a TextView with a background image, such as a
7864+ * Button. An example of non-overlapping rendering is a TextView with no background, or
7865+ * an ImageView with only the foreground image. The default implementation returns true;
7866+ * subclasses should override if they have cases which can be optimized.
7867+ *
7868+ * @return true if the content in this view might overlap, false otherwise.
7869+ */
7870+ public boolean hasOverlappingRendering() {
7871+ return true;
7872+ }
7873+
78577874 /**
78587875 * <p>Sets the opacity of the view. This is a value from 0 to 1, where 0 means the view is
78597876 * completely transparent and 1 means the view is completely opaque.</p>
@@ -11534,6 +11551,7 @@ void setDisplayListProperties() {
1153411551 void setDisplayListProperties(DisplayList displayList) {
1153511552 if (USE_DISPLAY_LIST_PROPERTIES && displayList != null) {
1153611553 displayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
11554+ displayList.setHasOverlappingRendering(hasOverlappingRendering());
1153711555 if (mParent instanceof ViewGroup) {
1153811556 displayList.setClipChildren(
1153911557 (((ViewGroup)mParent).mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) != 0);
0 commit comments