Disable shadow casting for transparent BitmapDrawables
bug:17013977 Change-Id: I26328c21360432bb34d3f19858dfdc0e6aede057
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.graphics.drawable;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.Resources.Theme;
|
||||
@@ -27,6 +28,7 @@ import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.PorterDuff;
|
||||
@@ -597,6 +599,16 @@ public class BitmapDrawable extends Drawable {
|
||||
mOpticalInsets = Insets.of(left, top, right, bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOutline(@NonNull Outline outline) {
|
||||
super.getOutline(outline);
|
||||
if (mBitmapState.mBitmap.hasAlpha()) {
|
||||
// Bitmaps with alpha can't report a non-0 alpha,
|
||||
// since they may not fill their rectangular bounds
|
||||
outline.setAlpha(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
final int oldAlpha = mBitmapState.mPaint.getAlpha();
|
||||
|
||||
Reference in New Issue
Block a user