void destroy() {
mInitialized = false;
updateEnabledState(null);
- mRootNode.discardDisplayList();
nDestroy(mNativeProxy, mRootNode.mNativeRenderNode);
}
*/
void destroyHardwareResources(View view) {
destroyResources(view);
- mRootNode.discardDisplayList();
nDestroyHardwareResources(mNativeProxy);
}
private static void destroyResources(View view) {
view.destroyHardwareResources();
+
+ if (view instanceof ViewGroup) {
+ ViewGroup group = (ViewGroup) view;
+
+ int count = group.getChildCount();
+ for (int i = 0; i < count; i++) {
+ destroyResources(group.getChildAt(i));
+ }
+ }
}
/**
// safe to free its copy of the display list as it knows that we will
// push an updated DisplayList if we try to draw again
resetDisplayList();
- if (mOverlay != null) {
- mOverlay.getOverlayView().destroyHardwareResources();
- }
- if (mGhostView != null) {
- mGhostView.destroyHardwareResources();
- }
}
/**
}
private void resetDisplayList() {
- mRenderNode.discardDisplayList();
+ if (mRenderNode.isValid()) {
+ mRenderNode.discardDisplayList();
+ }
- if (mBackgroundRenderNode != null) {
+ if (mBackgroundRenderNode != null && mBackgroundRenderNode.isValid()) {
mBackgroundRenderNode.discardDisplayList();
}
}
super.dispatchDetachedFromWindow();
}
- /** @hide */
- @Override
- protected void destroyHardwareResources() {
- super.destroyHardwareResources();
- int count = getChildCount();
- for (int i = 0; i < count; i++) {
- getChildAt(i).destroyHardwareResources();
- }
- }
-
/**
* @hide
*/
return;
}
- node->setStagingDisplayList(nullptr, nullptr);
// Update the valid field, since native has already removed
// the staging DisplayList
env->SetBooleanField(jnode, gRenderNode_validFieldID, false);