Merge "Reduce wasted buffer allocations" into mnc-dev
This commit is contained in:
@@ -148,7 +148,6 @@ public class ThreadedRenderer extends HardwareRenderer {
|
|||||||
mInitialized = true;
|
mInitialized = true;
|
||||||
updateEnabledState(surface);
|
updateEnabledState(surface);
|
||||||
boolean status = nInitialize(mNativeProxy, surface);
|
boolean status = nInitialize(mNativeProxy, surface);
|
||||||
surface.allocateBuffers();
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1705,10 +1705,19 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mFullRedrawNeeded = true;
|
mFullRedrawNeeded = true;
|
||||||
mPreviousTransparentRegion.setEmpty();
|
mPreviousTransparentRegion.setEmpty();
|
||||||
|
|
||||||
|
// Only initialize up-front if transparent regions are not
|
||||||
|
// requested, otherwise defer to see if the entire window
|
||||||
|
// will be transparent
|
||||||
if (mAttachInfo.mHardwareRenderer != null) {
|
if (mAttachInfo.mHardwareRenderer != null) {
|
||||||
try {
|
try {
|
||||||
hwInitialized = mAttachInfo.mHardwareRenderer.initialize(
|
hwInitialized = mAttachInfo.mHardwareRenderer.initialize(
|
||||||
mSurface);
|
mSurface);
|
||||||
|
if (hwInitialized && (host.mPrivateFlags
|
||||||
|
& View.PFLAG_REQUEST_TRANSPARENT_REGIONS) == 0) {
|
||||||
|
// Don't pre-allocate if transparent regions
|
||||||
|
// are requested as they may not be needed
|
||||||
|
mSurface.allocateBuffers();
|
||||||
|
}
|
||||||
} catch (OutOfResourcesException e) {
|
} catch (OutOfResourcesException e) {
|
||||||
handleOutOfResourcesException(e);
|
handleOutOfResourcesException(e);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user