Skip to content

Commit e0ad474

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Some optimizations for view inflation." into ics-mr1
2 parents e24ac4b + 68d9173 commit e0ad474

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

graphics/java/android/graphics/drawable/NinePatchDrawable.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,30 @@ public boolean getPadding(Rect padding) {
202202

203203
@Override
204204
public void setAlpha(int alpha) {
205+
if (mPaint == null && alpha == 0xFF) {
206+
// Fast common case -- leave at normal alpha.
207+
return;
208+
}
205209
getPaint().setAlpha(alpha);
206210
invalidateSelf();
207211
}
208212

209213
@Override
210214
public void setColorFilter(ColorFilter cf) {
215+
if (mPaint == null && cf == null) {
216+
// Fast common case -- leave at no color filter.
217+
return;
218+
}
211219
getPaint().setColorFilter(cf);
212220
invalidateSelf();
213221
}
214222

215223
@Override
216224
public void setDither(boolean dither) {
225+
if (mPaint == null && dither == DEFAULT_DITHER) {
226+
// Fast common case -- leave at default dither.
227+
return;
228+
}
217229
getPaint().setDither(dither);
218230
invalidateSelf();
219231
}

0 commit comments

Comments
 (0)