Loading graphics/java/android/graphics/drawable/LayerDrawable.java +15 −4 Original line number Diff line number Diff line Loading @@ -566,13 +566,24 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { } /** * Builds an Outline from the first child Drawable, if present. * Populates <code>outline</code> with the first available layer outline. * Returns <code>true</code> if an outline is available, <code>false</code> * otherwise. * * @param outline Outline in which to place the first available layer outline * @return <code>true</code> if an outline is available */ @Override public boolean getOutline(@NonNull Outline outline) { if (mLayerState.mNum < 1) return false; final Drawable firstChild = mLayerState.mChildren[0].mDrawable; return firstChild.getOutline(outline); final LayerState state = mLayerState; final ChildDrawable[] children = state.mChildren; final int N = state.mNum; for (int i = 0; i < N; i++) { if (children[i].mDrawable.getOutline(outline)) { return true; } } return false; } @Override Loading graphics/java/android/graphics/drawable/RippleDrawable.java +23 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.PorterDuff.Mode; Loading Loading @@ -497,8 +498,29 @@ public class RippleDrawable extends LayerDrawable { } } /** * Populates <code>outline</code> with the first available layer outline, * excluding the mask layer. Returns <code>true</code> if an outline is * available, <code>false</code> otherwise. * * @param outline Outline in which to place the first available layer outline * @return <code>true</code> if an outline is available */ @Override public boolean getOutline(@NonNull Outline outline) { final LayerState state = mLayerState; final ChildDrawable[] children = state.mChildren; final int N = state.mNum; for (int i = 0; i < N; i++) { if (children[i].mId != R.id.mask && children[i].mDrawable.getOutline(outline)) { return true; } } return false; } @Override public void draw(Canvas canvas) { public void draw(@NonNull Canvas canvas) { final boolean isProjected = isProjected(); final boolean hasMask = mMask != null; final boolean drawNonMaskContent = mLayerState.mNum > (hasMask ? 1 : 0); Loading Loading
graphics/java/android/graphics/drawable/LayerDrawable.java +15 −4 Original line number Diff line number Diff line Loading @@ -566,13 +566,24 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { } /** * Builds an Outline from the first child Drawable, if present. * Populates <code>outline</code> with the first available layer outline. * Returns <code>true</code> if an outline is available, <code>false</code> * otherwise. * * @param outline Outline in which to place the first available layer outline * @return <code>true</code> if an outline is available */ @Override public boolean getOutline(@NonNull Outline outline) { if (mLayerState.mNum < 1) return false; final Drawable firstChild = mLayerState.mChildren[0].mDrawable; return firstChild.getOutline(outline); final LayerState state = mLayerState; final ChildDrawable[] children = state.mChildren; final int N = state.mNum; for (int i = 0; i < N; i++) { if (children[i].mDrawable.getOutline(outline)) { return true; } } return false; } @Override Loading
graphics/java/android/graphics/drawable/RippleDrawable.java +23 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.PorterDuff.Mode; Loading Loading @@ -497,8 +498,29 @@ public class RippleDrawable extends LayerDrawable { } } /** * Populates <code>outline</code> with the first available layer outline, * excluding the mask layer. Returns <code>true</code> if an outline is * available, <code>false</code> otherwise. * * @param outline Outline in which to place the first available layer outline * @return <code>true</code> if an outline is available */ @Override public boolean getOutline(@NonNull Outline outline) { final LayerState state = mLayerState; final ChildDrawable[] children = state.mChildren; final int N = state.mNum; for (int i = 0; i < N; i++) { if (children[i].mId != R.id.mask && children[i].mDrawable.getOutline(outline)) { return true; } } return false; } @Override public void draw(Canvas canvas) { public void draw(@NonNull Canvas canvas) { final boolean isProjected = isProjected(); final boolean hasMask = mMask != null; final boolean drawNonMaskContent = mLayerState.mNum > (hasMask ? 1 : 0); Loading