Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68d91733 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Some optimizations for view inflation.

Change-Id: I8e5e6dda4d4c9776961d4a070549d5753588e582
parent 17bd9a22
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -202,18 +202,30 @@ public class NinePatchDrawable extends Drawable {

    @Override
    public void setAlpha(int alpha) {
        if (mPaint == null && alpha == 0xFF) {
            // Fast common case -- leave at normal alpha.
            return;
        }
        getPaint().setAlpha(alpha);
        invalidateSelf();
    }
    
    @Override
    public void setColorFilter(ColorFilter cf) {
        if (mPaint == null && cf == null) {
            // Fast common case -- leave at no color filter.
            return;
        }
        getPaint().setColorFilter(cf);
        invalidateSelf();
    }

    @Override
    public void setDither(boolean dither) {
        if (mPaint == null && dither == DEFAULT_DITHER) {
            // Fast common case -- leave at default dither.
            return;
        }
        getPaint().setDither(dither);
        invalidateSelf();
    }