summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-10-26 14:22:30 -0700
committerRomain Guy <romainguy@google.com>2010-10-26 14:22:30 -0700
commit0d9275e565551eed57297627188aa39f3897a50b (patch)
tree0b70a070bb7865eb5ce36eb6a319f44d69f3fd19
parent48c9daac20dcae18bf45e528fd073612bc0122e1 (diff)
downloadframeworks_base-0d9275e565551eed57297627188aa39f3897a50b.zip
frameworks_base-0d9275e565551eed57297627188aa39f3897a50b.tar.gz
frameworks_base-0d9275e565551eed57297627188aa39f3897a50b.tar.bz2
Enable display lists.
Change-Id: Id0d9b987251da5b7ecbb5497a55dbb5937430316
-rw-r--r--core/java/android/view/View.java9
-rw-r--r--core/java/android/view/ViewGroup.java13
-rw-r--r--core/java/android/view/ViewRoot.java5
-rw-r--r--core/java/android/widget/SlidingDrawer.java2
4 files changed, 23 insertions, 6 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 0456463..87e03cf 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -7579,6 +7579,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* the auto scaling to true. Doing so, however, will generate a bitmap of a different
* size than the view. This implies that your application must be able to handle this
* size.</p>
+ *
+ * <p>You should avoid calling this method when hardware acceleration is enabled. If
+ * you do not need the drawing cache bitmap, calling this method will increase memory
+ * usage and cause the view to be rendered in software once, thus negatively impacting
+ * performance.</p>
*
* @see #getDrawingCache()
* @see #destroyDrawingCache()
@@ -7699,7 +7704,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
canvas.translate(-mScrollX, -mScrollY);
mPrivateFlags |= DRAWN;
- mPrivateFlags |= DRAWING_CACHE_VALID;
+ if (mAttachInfo == null || !mAttachInfo.mHardwareAccelerated) {
+ mPrivateFlags |= DRAWING_CACHE_VALID;
+ }
// Fast path for layouts with no backgrounds
if ((mPrivateFlags & SKIP_DRAW) == SKIP_DRAW) {
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 7b2703b..b881bdd 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -1867,12 +1867,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
if ((mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE) {
final int count = mChildrenCount;
final View[] children = mChildren;
+ final boolean buildCache = !isHardwareAccelerated();
for (int i = 0; i < count; i++) {
final View child = children[i];
if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
child.setDrawingCacheEnabled(true);
- child.buildDrawingCache(true);
+ if (buildCache) {
+ child.buildDrawingCache(true);
+ }
}
}
@@ -1933,6 +1936,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
if ((flags & FLAG_RUN_ANIMATION) != 0 && canAnimate()) {
final boolean cache = (mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE;
+ final boolean buildCache = !isHardwareAccelerated();
for (int i = 0; i < count; i++) {
final View child = children[i];
if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
@@ -1941,7 +1945,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
bindLayoutAnimation(child);
if (cache) {
child.setDrawingCacheEnabled(true);
- child.buildDrawingCache(true);
+ if (buildCache) {
+ child.buildDrawingCache(true);
+ }
}
}
}
@@ -2205,8 +2211,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
if (!canvas.isHardwareAccelerated()) {
cache = child.getDrawingCache(true);
} else {
- // TODO: bring back
- // displayList = child.getDisplayList();
+ displayList = child.getDisplayList();
}
}
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 2e368b8..06261bb 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -561,6 +561,11 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn
scheduleTraversals();
}
}
+
+ void invalidate() {
+ mDirty.set(0, 0, mWidth, mHeight);
+ scheduleTraversals();
+ }
public ViewParent getParent() {
return null;
diff --git a/core/java/android/widget/SlidingDrawer.java b/core/java/android/widget/SlidingDrawer.java
index 11d72de..bdeb5c2 100644
--- a/core/java/android/widget/SlidingDrawer.java
+++ b/core/java/android/widget/SlidingDrawer.java
@@ -652,7 +652,7 @@ public class SlidingDrawer extends ViewGroup {
// Try only once... we should really loop but it's not a big deal
// if the draw was cancelled, it will only be temporary anyway
content.getViewTreeObserver().dispatchOnPreDraw();
- content.buildDrawingCache();
+ if (!content.isHardwareAccelerated()) content.buildDrawingCache();
content.setVisibility(View.GONE);
}