Merge "Don't draw fully transparent views/primitives."
This commit is contained in:
@ -24,6 +24,20 @@ import android.util.SparseArray;
|
||||
* Contains methods to standard constants used in the UI for timeouts, sizes, and distances.
|
||||
*/
|
||||
public class ViewConfiguration {
|
||||
/**
|
||||
* Expected bit depth of the display panel.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final float PANEL_BIT_DEPTH = 24;
|
||||
|
||||
/**
|
||||
* Minimum alpha required for a view to draw.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final float ALPHA_THRESHOLD = 0.5f / PANEL_BIT_DEPTH;
|
||||
|
||||
/**
|
||||
* Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in
|
||||
* pixels
|
||||
|
@ -69,7 +69,7 @@ import java.util.ArrayList;
|
||||
public abstract class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
|
||||
private static final boolean DBG = false;
|
||||
|
||||
|
||||
/**
|
||||
* Views which have been hidden or removed which need to be animated on
|
||||
* their way out.
|
||||
@ -2185,6 +2185,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
(child.mPrivateFlags & DRAW_ANIMATION) == 0) {
|
||||
return more;
|
||||
}
|
||||
|
||||
float alpha = child.getAlpha();
|
||||
// Bail out early if the view does not need to be drawn
|
||||
if (alpha <= ViewConfiguration.ALPHA_THRESHOLD) return more;
|
||||
|
||||
child.computeScroll();
|
||||
|
||||
@ -2217,8 +2221,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
}
|
||||
}
|
||||
|
||||
float alpha = child.getAlpha();
|
||||
|
||||
if (transformToApply != null || alpha < 1.0f || !child.hasIdentityMatrix()) {
|
||||
int transX = 0;
|
||||
int transY = 0;
|
||||
@ -2253,7 +2255,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
|
||||
if (alpha < 1.0f) {
|
||||
mGroupFlags |= FLAG_CLEAR_TRANSFORMATION;
|
||||
|
||||
|
||||
if (hasNoCache) {
|
||||
final int multipliedAlpha = (int) (255 * alpha);
|
||||
if (!child.onSetAlpha(multipliedAlpha)) {
|
||||
|
Reference in New Issue
Block a user