Methods Summary |
---|
void | buildLayer(RenderNode node)
nBuildLayer(mNativeProxy, node.getNativeDisplayList());
|
private static boolean | checkIfProfilingRequested()
String profiling = SystemProperties.get(HardwareRenderer.PROFILE_PROPERTY);
int graphType = search(VISUALIZERS, profiling);
return (graphType >= 0) || Boolean.parseBoolean(profiling);
|
boolean | copyLayerInto(HardwareLayer layer, android.graphics.Bitmap bitmap)
return nCopyLayerInto(mNativeProxy,
layer.getDeferredLayerUpdater(), bitmap.mNativeBitmap);
|
HardwareLayer | createTextureLayer()
long layer = nCreateTextureLayer(mNativeProxy);
return HardwareLayer.adoptTextureLayer(this, layer);
|
void | destroy()
mInitialized = false;
updateEnabledState(null);
nDestroy(mNativeProxy);
|
void | destroyHardwareResources(View view)
destroyResources(view);
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));
}
}
|
void | detachSurfaceTexture(long hardwareLayer)
nDetachSurfaceTexture(mNativeProxy, hardwareLayer);
|
void | draw(View view, android.view.View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks)
attachInfo.mIgnoreDirtyState = true;
long frameTimeNanos = mChoreographer.getFrameTimeNanos();
attachInfo.mDrawingTime = frameTimeNanos / TimeUtils.NANOS_PER_MS;
long recordDuration = 0;
if (mProfilingEnabled) {
recordDuration = System.nanoTime();
}
updateRootDisplayList(view, callbacks);
if (mProfilingEnabled) {
recordDuration = System.nanoTime() - recordDuration;
}
attachInfo.mIgnoreDirtyState = false;
// register animating rendernodes which started animating prior to renderer
// creation, which is typical for animators started prior to first draw
if (attachInfo.mPendingAnimatingRenderNodes != null) {
final int count = attachInfo.mPendingAnimatingRenderNodes.size();
for (int i = 0; i < count; i++) {
registerAnimatingRenderNode(
attachInfo.mPendingAnimatingRenderNodes.get(i));
}
attachInfo.mPendingAnimatingRenderNodes.clear();
// We don't need this anymore as subsequent calls to
// ViewRootImpl#attachRenderNodeAnimator will go directly to us.
attachInfo.mPendingAnimatingRenderNodes = null;
}
int syncResult = nSyncAndDrawFrame(mNativeProxy, frameTimeNanos,
recordDuration, view.getResources().getDisplayMetrics().density);
if ((syncResult & SYNC_LOST_SURFACE_REWARD_IF_FOUND) != 0) {
setEnabled(false);
attachInfo.mViewRootImpl.mSurface.release();
// Invalidate since we failed to draw. This should fetch a Surface
// if it is still needed or do nothing if we are no longer drawing
attachInfo.mViewRootImpl.invalidate();
}
if ((syncResult & SYNC_INVALIDATE_REQUIRED) != 0) {
attachInfo.mViewRootImpl.invalidate();
}
|
void | dumpGfxInfo(java.io.PrintWriter pw, java.io.FileDescriptor fd)
pw.flush();
nDumpProfileInfo(mNativeProxy, fd);
|
void | fence()
nFence(mNativeProxy);
|
protected void | finalize()
try {
nDeleteProxy(mNativeProxy);
mNativeProxy = 0;
} finally {
super.finalize();
}
|
int | getHeight()
return mHeight;
|
int | getWidth()
return mWidth;
|
boolean | initialize(Surface surface)
mInitialized = true;
updateEnabledState(surface);
boolean status = nInitialize(mNativeProxy, surface);
surface.allocateBuffers();
return status;
|
void | invalidate(Surface surface)
updateSurface(surface);
|
void | invalidateRoot()
mRootNodeNeedsUpdate = true;
|
static void | invokeFunctor(long functor, boolean waitForCompletion)
nInvokeFunctor(functor, waitForCompletion);
|
boolean | loadSystemProperties()
boolean changed = nLoadSystemProperties(mNativeProxy);
boolean wantProfiling = checkIfProfilingRequested();
if (wantProfiling != mProfilingEnabled) {
mProfilingEnabled = wantProfiling;
changed = true;
}
if (changed) {
invalidateRoot();
}
return changed;
|
private static native void | nBuildLayer(long nativeProxy, long node)
|
private static native void | nCancelLayerUpdate(long nativeProxy, long layer)
|
private static native boolean | nCopyLayerInto(long nativeProxy, long layer, long bitmap)
|
private static native long | nCreateProxy(boolean translucent, long rootRenderNode)
|
private static native long | nCreateRootRenderNode()
|
private static native long | nCreateTextureLayer(long nativeProxy)
|
private static native void | nDeleteProxy(long nativeProxy)
|
private static native void | nDestroy(long nativeProxy)
|
private static native void | nDestroyHardwareResources(long nativeProxy)
|
private static native void | nDetachSurfaceTexture(long nativeProxy, long layer)
|
private static native void | nDumpProfileInfo(long nativeProxy, java.io.FileDescriptor fd)
|
private static native void | nFence(long nativeProxy)
|
private static native boolean | nInitialize(long nativeProxy, Surface window)
|
private static native void | nInvokeFunctor(long functor, boolean waitForCompletion)
|
private static native boolean | nLoadSystemProperties(long nativeProxy)
|
private static native void | nNotifyFramePending(long nativeProxy)
|
private static native boolean | nPauseSurface(long nativeProxy, Surface window)
|
private static native void | nPushLayerUpdate(long nativeProxy, long layer)
|
private static native void | nRegisterAnimatingRenderNode(long rootRenderNode, long animatingNode)
|
private static native void | nSetAtlas(long nativeProxy, GraphicBuffer buffer, long[] map)
|
private static native void | nSetFrameInterval(long nativeProxy, long frameIntervalNanos)
|
private static native void | nSetOpaque(long nativeProxy, boolean opaque)
|
private static native void | nSetup(long nativeProxy, int width, int height, float lightX, float lightY, float lightZ, float lightRadius, int ambientShadowAlpha, int spotShadowAlpha)
|
private static native void | nStopDrawing(long nativeProxy)
|
private static native int | nSyncAndDrawFrame(long nativeProxy, long frameTimeNanos, long recordDuration, float density)
|
private static native void | nTrimMemory(int level)
|
private static native void | nUpdateSurface(long nativeProxy, Surface window)
|
public void | notifyFramePending()
nNotifyFramePending(mNativeProxy);
|
void | onLayerDestroyed(HardwareLayer layer)
nCancelLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater());
|
boolean | pauseSurface(Surface surface)
return nPauseSurface(mNativeProxy, surface);
|
void | pushLayerUpdate(HardwareLayer layer)
nPushLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater());
|
void | registerAnimatingRenderNode(RenderNode animator)
nRegisterAnimatingRenderNode(mRootNode.mNativeRenderNode, animator.mNativeRenderNode);
|
private static int | search(java.lang.String[] values, java.lang.String value)
for (int i = 0; i < values.length; i++) {
if (values[i].equals(value)) return i;
}
return -1;
|
void | setName(java.lang.String name)
|
void | setOpaque(boolean opaque)
nSetOpaque(mNativeProxy, opaque && !mHasInsets);
|
void | setup(int width, int height, android.graphics.Rect surfaceInsets)
final float lightX = width / 2.0f;
mWidth = width;
mHeight = height;
if (surfaceInsets != null && (surfaceInsets.left != 0 || surfaceInsets.right != 0
|| surfaceInsets.top != 0 || surfaceInsets.bottom != 0)) {
mHasInsets = true;
mInsetLeft = surfaceInsets.left;
mInsetTop = surfaceInsets.top;
mSurfaceWidth = width + mInsetLeft + surfaceInsets.right;
mSurfaceHeight = height + mInsetTop + surfaceInsets.bottom;
// If the surface has insets, it can't be opaque.
setOpaque(false);
} else {
mHasInsets = false;
mInsetLeft = 0;
mInsetTop = 0;
mSurfaceWidth = width;
mSurfaceHeight = height;
}
mRootNode.setLeftTopRightBottom(-mInsetLeft, -mInsetTop, mSurfaceWidth, mSurfaceHeight);
nSetup(mNativeProxy, mSurfaceWidth, mSurfaceHeight,
lightX, mLightY, mLightZ, mLightRadius,
mAmbientShadowAlpha, mSpotShadowAlpha);
|
static native void | setupShadersDiskCache(java.lang.String cacheFile)
|
void | stopDrawing()
nStopDrawing(mNativeProxy);
|
static void | trimMemory(int level)
nTrimMemory(level);
|
private void | updateEnabledState(Surface surface)
if (surface == null || !surface.isValid()) {
setEnabled(false);
} else {
setEnabled(mInitialized);
}
|
private void | updateRootDisplayList(View view, HardwareDrawCallbacks callbacks)
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "Record View#draw()");
updateViewTreeDisplayList(view);
if (mRootNodeNeedsUpdate || !mRootNode.isValid()) {
HardwareCanvas canvas = mRootNode.start(mSurfaceWidth, mSurfaceHeight);
try {
final int saveCount = canvas.save();
canvas.translate(mInsetLeft, mInsetTop);
callbacks.onHardwarePreDraw(canvas);
canvas.insertReorderBarrier();
canvas.drawRenderNode(view.getDisplayList());
canvas.insertInorderBarrier();
callbacks.onHardwarePostDraw(canvas);
canvas.restoreToCount(saveCount);
mRootNodeNeedsUpdate = false;
} finally {
mRootNode.end(canvas);
}
}
Trace.traceEnd(Trace.TRACE_TAG_VIEW);
|
void | updateSurface(Surface surface)
updateEnabledState(surface);
nUpdateSurface(mNativeProxy, surface);
|
private void | updateViewTreeDisplayList(View view)
view.mPrivateFlags |= View.PFLAG_DRAWN;
view.mRecreateDisplayList = (view.mPrivateFlags & View.PFLAG_INVALIDATED)
== View.PFLAG_INVALIDATED;
view.mPrivateFlags &= ~View.PFLAG_INVALIDATED;
view.getDisplayList();
view.mRecreateDisplayList = false;
|