Remove redundant computeScroll() call for hw-accelerated views
View.draw() calls computeScroll() to initialize scrolling values correctly.
But getDisplayList() also calls computeScroll() for the same reason, resulting
in 2 calls to that method for hw-accelerated views.
Fix: avoid calling computeScroll() in View.draw() for views with display lists.
Change-Id: I57a3862e2d554752cd0fdb862513cbb3dfb3105c
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index c269ea3..d6441f6 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -12909,11 +12909,6 @@
mPrivateFlags &= ~INVALIDATED;
}
- computeScroll();
-
- final int sx = mScrollX;
- final int sy = mScrollY;
-
DisplayList displayList = null;
Bitmap cache = null;
boolean hasDisplayList = false;
@@ -12960,6 +12955,14 @@
}
}
+ int sx = 0;
+ int sy = 0;
+ if (!hasDisplayList) {
+ computeScroll();
+ sx = mScrollX;
+ sy = mScrollY;
+ }
+
final boolean hasNoCache = cache == null || hasDisplayList;
final boolean offsetForScroll = cache == null && !hasDisplayList &&
layerType != LAYER_TYPE_HARDWARE;