Loading graphics/java/android/graphics/drawable/Drawable.java +65 −50 Original line number Diff line number Diff line Loading @@ -96,11 +96,12 @@ import android.util.TypedValue; * and Internationalization</a>. */ public abstract class Drawable { private static final Rect ZERO_BOUNDS_RECT = new Rect(); private int[] mStateSet = StateSet.WILD_CARD; private int mLevel = 0; private int mChangingConfigurations = 0; private Rect mBounds = new Rect(); private Rect mBounds = ZERO_BOUNDS_RECT; /*package*/ Callback mCallback = null; private boolean mVisible = true; Loading @@ -119,6 +120,10 @@ public abstract class Drawable { public void setBounds(int left, int top, int right, int bottom) { Rect oldBounds = mBounds; if (oldBounds == ZERO_BOUNDS_RECT) { oldBounds = mBounds = new Rect(); } if (oldBounds.left != left || oldBounds.top != top || oldBounds.right != right || oldBounds.bottom != bottom) { mBounds.set(left, top, right, bottom); Loading Loading @@ -150,7 +155,7 @@ public abstract class Drawable { * Return a copy of the drawable's bounds in a new Rect. This returns the * same values as getBounds(), but the returned object is guaranteed to not * be changed later by the drawable (i.e. it retains no reference to this * rect). If the caller already has a Rect allocated, call copyBounds(rect) * rect). If the caller already has a Rect allocated, call copyBounds(rect). * * @return A copy of the drawable's bounds */ Loading @@ -163,11 +168,21 @@ public abstract class Drawable { * object may be the same object stored in the drawable (though this is not * guaranteed), so if a persistent copy of the bounds is needed, call * copyBounds(rect) instead. * You should also not change the object returned by this method as it may * be the same object stored in the drawable. * * @return The bounds of the drawable (which may change later, so caller * beware). * beware). DO NOT ALTER the returned object as it may change the * stored bounds of this drawable. * * @see #copyBounds() * @see #copyBounds(android.graphics.Rect) */ public final Rect getBounds() { if (mBounds == ZERO_BOUNDS_RECT) { mBounds = new Rect(); } return mBounds; } Loading Loading
graphics/java/android/graphics/drawable/Drawable.java +65 −50 Original line number Diff line number Diff line Loading @@ -96,11 +96,12 @@ import android.util.TypedValue; * and Internationalization</a>. */ public abstract class Drawable { private static final Rect ZERO_BOUNDS_RECT = new Rect(); private int[] mStateSet = StateSet.WILD_CARD; private int mLevel = 0; private int mChangingConfigurations = 0; private Rect mBounds = new Rect(); private Rect mBounds = ZERO_BOUNDS_RECT; /*package*/ Callback mCallback = null; private boolean mVisible = true; Loading @@ -119,6 +120,10 @@ public abstract class Drawable { public void setBounds(int left, int top, int right, int bottom) { Rect oldBounds = mBounds; if (oldBounds == ZERO_BOUNDS_RECT) { oldBounds = mBounds = new Rect(); } if (oldBounds.left != left || oldBounds.top != top || oldBounds.right != right || oldBounds.bottom != bottom) { mBounds.set(left, top, right, bottom); Loading Loading @@ -150,7 +155,7 @@ public abstract class Drawable { * Return a copy of the drawable's bounds in a new Rect. This returns the * same values as getBounds(), but the returned object is guaranteed to not * be changed later by the drawable (i.e. it retains no reference to this * rect). If the caller already has a Rect allocated, call copyBounds(rect) * rect). If the caller already has a Rect allocated, call copyBounds(rect). * * @return A copy of the drawable's bounds */ Loading @@ -163,11 +168,21 @@ public abstract class Drawable { * object may be the same object stored in the drawable (though this is not * guaranteed), so if a persistent copy of the bounds is needed, call * copyBounds(rect) instead. * You should also not change the object returned by this method as it may * be the same object stored in the drawable. * * @return The bounds of the drawable (which may change later, so caller * beware). * beware). DO NOT ALTER the returned object as it may change the * stored bounds of this drawable. * * @see #copyBounds() * @see #copyBounds(android.graphics.Rect) */ public final Rect getBounds() { if (mBounds == ZERO_BOUNDS_RECT) { mBounds = new Rect(); } return mBounds; } Loading