Merge "Enable display lists."

This commit is contained in:
Romain Guy
2010-10-26 14:26:15 -07:00
committed by Android (Google) Code Review
4 changed files with 23 additions and 6 deletions

View File

@@ -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) {

View File

@@ -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();
}
}

View File

@@ -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;

View File

@@ -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);
}