summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-05-08 14:52:48 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-08 14:52:48 -0700
commit27ef44c46d24a5800e227d945ffede813d7f28f7 (patch)
tree4c6fe81ef0c16df876af6548f22cae79a9a87aac
parent14326fd456f8b457e4ab7b53393b9b1e0d1726aa (diff)
parent2a0f228a30c85a124f92a5a7c1b10a81cf69af6d (diff)
downloadframeworks_base-27ef44c46d24a5800e227d945ffede813d7f28f7.zip
frameworks_base-27ef44c46d24a5800e227d945ffede813d7f28f7.tar.gz
frameworks_base-27ef44c46d24a5800e227d945ffede813d7f28f7.tar.bz2
Merge "Invalidate display lists immediately when views are removed/added quickly" into jb-dev
-rw-r--r--core/java/android/view/View.java15
-rw-r--r--core/java/android/view/ViewRootImpl.java13
2 files changed, 20 insertions, 8 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 5032fe0..2befcce 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -11096,22 +11096,30 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
mParent.requestTransparentRegion(this);
}
+
if ((mPrivateFlags & AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {
initialAwakenScrollBars();
mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
}
+
jumpDrawablesToCurrentState();
+
// Order is important here: LayoutDirection MUST be resolved before Padding
// and TextDirection
resolveLayoutDirection();
resolvePadding();
resolveTextDirection();
resolveTextAlignment();
+
clearAccessibilityFocus();
if (isFocused()) {
InputMethodManager imm = InputMethodManager.peekInstance();
imm.focusIn(this);
}
+
+ if (mAttachInfo != null && mDisplayList != null) {
+ mAttachInfo.mViewRootImpl.dequeueDisplayList(mDisplayList);
+ }
}
/**
@@ -11332,7 +11340,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
if (mAttachInfo != null) {
if (mDisplayList != null) {
- mAttachInfo.mViewRootImpl.invalidateDisplayList(mDisplayList);
+ mAttachInfo.mViewRootImpl.enqueueDisplayList(mDisplayList);
}
mAttachInfo.mViewRootImpl.cancelInvalidate(this);
} else {
@@ -12026,7 +12034,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
boolean caching = false;
final HardwareCanvas canvas = displayList.start();
- int restoreCount = 0;
int width = mRight - mLeft;
int height = mBottom - mTop;
@@ -12659,10 +12666,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
return more;
}
- void setDisplayListProperties() {
- setDisplayListProperties(mDisplayList);
- }
-
/**
* This method is called by getDisplayList() when a display list is created or re-rendered.
* It sets or resets the current value of all properties on that display list (resetting is
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index ec6bd81..5f295cb 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -4412,14 +4412,23 @@ public final class ViewRootImpl implements ViewParent,
mInvalidateOnAnimationRunnable.addViewRect(info);
}
- public void invalidateDisplayList(DisplayList displayList) {
+ public void enqueueDisplayList(DisplayList displayList) {
mDisplayLists.add(displayList);
mHandler.removeMessages(MSG_INVALIDATE_DISPLAY_LIST);
Message msg = mHandler.obtainMessage(MSG_INVALIDATE_DISPLAY_LIST);
mHandler.sendMessage(msg);
}
-
+
+ public void dequeueDisplayList(DisplayList displayList) {
+ if (mDisplayLists.remove(displayList)) {
+ displayList.invalidate();
+ if (mDisplayLists.size() == 0) {
+ mHandler.removeMessages(MSG_INVALIDATE_DISPLAY_LIST);
+ }
+ }
+ }
+
public void cancelInvalidate(View view) {
mHandler.removeMessages(MSG_INVALIDATE, view);
// fixme: might leak the AttachInfo.InvalidateInfo objects instead of returning