Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 21aec19d authored by Chet Haase's avatar Chet Haase Committed by Android (Google) Code Review
Browse files

Merge "Optimization of alpha with DisplayList properties"

parents 66ac9027 db8c9a6a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23373,6 +23373,7 @@ package android.view {
    method public boolean hasFocus();
    method public boolean hasFocusable();
    method public boolean hasOnClickListeners();
    method public boolean hasOverlappingRendering();
    method public boolean hasTransientState();
    method public boolean hasWindowFocus();
    method public static android.view.View inflate(android.content.Context, int, android.view.ViewGroup);
+9 −0
Original line number Diff line number Diff line
@@ -148,6 +148,15 @@ public abstract class DisplayList {
     */
    public abstract void setAlpha(float alpha);

    /**
     * Sets whether the DisplayList renders content which overlaps. Non-overlapping rendering
     * can use a fast path for alpha that avoids rendering to an offscreen buffer.
     *
     * @param hasOverlappingRendering
     * @see android.view.View#hasOverlappingRendering()
     */
    public abstract void setHasOverlappingRendering(boolean hasOverlappingRendering);

    /**
     * Sets the translationX value for the DisplayList
     *
+11 −0
Original line number Diff line number Diff line
@@ -146,6 +146,15 @@ class GLES20DisplayList extends DisplayList {
        }
    }

    @Override
    public void setHasOverlappingRendering(boolean hasOverlappingRendering) {
        try {
            nSetHasOverlappingRendering(getNativeDisplayList(), hasOverlappingRendering);
        } catch (IllegalStateException e) {
            // invalid DisplayList okay: we'll set current values the next time we render to it
        }
    }

    @Override
    public void setTranslationX(float translationX) {
        try {
@@ -335,6 +344,8 @@ class GLES20DisplayList extends DisplayList {
    private static native void nSetClipChildren(int displayList, boolean clipChildren);
    private static native void nSetApplicationScale(int displayList, float scale);
    private static native void nSetAlpha(int displayList, float alpha);
    private static native void nSetHasOverlappingRendering(int displayList,
            boolean hasOverlappingRendering);
    private static native void nSetTranslationX(int displayList, float translationX);
    private static native void nSetTranslationY(int displayList, float translationY);
    private static native void nSetRotation(int displayList, float rotation);
+1 −5
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ public abstract class HardwareRenderer {
    /**
     * Number of frames to profile.
     */
    private static final int PROFILE_MAX_FRAMES = 64;
    private static final int PROFILE_MAX_FRAMES = 120;

    /**
     * Number of floats per profiled frame.
@@ -1046,10 +1046,6 @@ public abstract class HardwareRenderer {
                                Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- getDisplayList() took " +
                                        total + "ms");
                            }
                            if (View.USE_DISPLAY_LIST_PROPERTIES) {
                                Log.d("DLProperties", "getDisplayList():\t" +
                                        mProfileData[mProfileCurrentFrame]);
                            }
                        }

                        if (displayList != null) {
+31 −13
Original line number Diff line number Diff line
@@ -2829,19 +2829,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     */
    private boolean mSendingHoverAccessibilityEvents;
    /**
     * Delegate for injecting accessiblity functionality.
     */
    AccessibilityDelegate mAccessibilityDelegate;
    /**
     * Consistency verifier for debugging purposes.
     * @hide
     */
    protected final InputEventConsistencyVerifier mInputEventConsistencyVerifier =
            InputEventConsistencyVerifier.isInstrumentationEnabled() ?
                    new InputEventConsistencyVerifier(this, 0) : null;
    /**
     * Simple constructor to use when creating a view from code.
     *
@@ -2862,6 +2849,19 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        mUserPaddingRelative = false;
    }
    /**
     * Delegate for injecting accessiblity functionality.
     */
    AccessibilityDelegate mAccessibilityDelegate;
    /**
     * Consistency verifier for debugging purposes.
     * @hide
     */
    protected final InputEventConsistencyVerifier mInputEventConsistencyVerifier =
            InputEventConsistencyVerifier.isInstrumentationEnabled() ?
                    new InputEventConsistencyVerifier(this, 0) : null;
    /**
     * Constructor that is called when inflating a view from XML. This is called
     * when a view is being constructed from an XML file, supplying attributes
@@ -7854,6 +7854,23 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        return mTransformationInfo != null ? mTransformationInfo.mAlpha : 1;
    }
    /**
     * Returns whether this View has content which overlaps. This function, intended to be
     * overridden by specific View types, is an optimization when alpha is set on a view. If
     * rendering overlaps in a view with alpha < 1, that view is drawn to an offscreen buffer
     * and then composited it into place, which can be expensive. If the view has no overlapping
     * rendering, the view can draw each primitive with the appropriate alpha value directly.
     * An example of overlapping rendering is a TextView with a background image, such as a
     * Button. An example of non-overlapping rendering is a TextView with no background, or
     * an ImageView with only the foreground image. The default implementation returns true;
     * subclasses should override if they have cases which can be optimized.
     *
     * @return true if the content in this view might overlap, false otherwise.
     */
    public boolean hasOverlappingRendering() {
        return true;
    }
    /**
     * <p>Sets the opacity of the view. This is a value from 0 to 1, where 0 means the view is
     * completely transparent and 1 means the view is completely opaque.</p>
@@ -11534,6 +11551,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
    void setDisplayListProperties(DisplayList displayList) {
        if (USE_DISPLAY_LIST_PROPERTIES && displayList != null) {
            displayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
            displayList.setHasOverlappingRendering(hasOverlappingRendering());
            if (mParent instanceof ViewGroup) {
                displayList.setClipChildren(
                        (((ViewGroup)mParent).mGroupFlags & ViewGroup.FLAG_CLIP_CHILDREN) != 0);
Loading