Don't call saveLayer() when it's not required

Bug #5435653

saveLayer() can be extremely expensive on some GPU architectures. Avoiding
this call greatly improve the rendering performance of drawables with
strok + fill.

Change-Id: Ib414174ba05d5bad56d942b8e67ab784e7d60b9e
This commit is contained in:
Romain Guy
2011-10-10 15:22:25 -07:00
parent 589b0bb6ab
commit 098ffcd521

View File

@@ -285,7 +285,7 @@ public class GradientDrawable extends Drawable {
of the fill (if any) without worrying about blending artifacts.
*/
final boolean useLayer = haveStroke && haveFill && st.mShape != LINE &&
currStrokeAlpha < 255;
currStrokeAlpha < 255 && (mAlpha < 255 || mColorFilter != null);
/* Drawing with a layer is slower than direct drawing, but it
allows us to apply paint effects like alpha and colorfilter to