Avoid ripple buffer creation for empty bounds automerge: b74155c
automerge: e6e216c
* commit 'e6e216c48ea25bdbc2d0a262c74670fb6513e42b':
Avoid ripple buffer creation for empty bounds
This commit is contained in:
@@ -661,7 +661,8 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
|
|
||||||
mHasValidMask = true;
|
mHasValidMask = true;
|
||||||
|
|
||||||
if (maskType == MASK_NONE) {
|
final Rect bounds = getBounds();
|
||||||
|
if (maskType == MASK_NONE || bounds.isEmpty()) {
|
||||||
if (mMaskBuffer != null) {
|
if (mMaskBuffer != null) {
|
||||||
mMaskBuffer.recycle();
|
mMaskBuffer.recycle();
|
||||||
mMaskBuffer = null;
|
mMaskBuffer = null;
|
||||||
@@ -674,7 +675,6 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we have a correctly-sized buffer.
|
// Ensure we have a correctly-sized buffer.
|
||||||
final Rect bounds = getBounds();
|
|
||||||
if (mMaskBuffer == null
|
if (mMaskBuffer == null
|
||||||
|| mMaskBuffer.getWidth() != bounds.width()
|
|| mMaskBuffer.getWidth() != bounds.width()
|
||||||
|| mMaskBuffer.getHeight() != bounds.height()) {
|
|| mMaskBuffer.getHeight() != bounds.height()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user