Skip to content

Commit 098ffcd

Browse files
author
Romain Guy
committed
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
1 parent 589b0bb commit 098ffcd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

graphics/java/android/graphics/drawable/GradientDrawable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public void draw(Canvas canvas) {
285285
of the fill (if any) without worrying about blending artifacts.
286286
*/
287287
final boolean useLayer = haveStroke && haveFill && st.mShape != LINE &&
288-
currStrokeAlpha < 255;
288+
currStrokeAlpha < 255 && (mAlpha < 255 || mColorFilter != null);
289289

290290
/* Drawing with a layer is slower than direct drawing, but it
291291
allows us to apply paint effects like alpha and colorfilter to

0 commit comments

Comments
 (0)