public final class ThreadedRenderer extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
ThreadedRenderer.DumpFlags |
Modifier and Type | Field and Description |
---|---|
static String |
DEBUG_DIRTY_REGIONS_PROPERTY
Turn on to draw dirty regions every other frame.
|
static String |
DEBUG_OVERDRAW_PROPERTY
Controls overdraw debugging.
|
static String |
DEBUG_SHOW_LAYERS_UPDATES_PROPERTY
Turn on to flash hardware layers when they update.
|
static String |
DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY
Turn on to debug non-rectangular clip operations.
|
static String |
OVERDRAW_PROPERTY_SHOW
Value for
DEBUG_OVERDRAW_PROPERTY . |
static String |
PROFILE_PROPERTY
System property used to enable or disable hardware rendering profiling.
|
static String |
PROFILE_PROPERTY_VISUALIZE_BARS
Value for
PROFILE_PROPERTY . |
static boolean |
sRendererDisabled
A process can set this flag to false to prevent the use of hardware
rendering.
|
static boolean |
sSystemRendererDisabled
Further hardware renderer disabling for the system process.
|
static boolean |
sTrimForeground |
Modifier and Type | Method and Description |
---|---|
void |
addRenderNode(RenderNode node,
boolean placeFront)
Adds a rendernode to the renderer which can be drawn and changed asynchronously to the
rendernode of the UI thread.
|
static int |
copySurfaceInto(Surface surface,
Bitmap bitmap) |
static ThreadedRenderer |
create(Context context,
boolean translucent)
Creates a hardware renderer using OpenGL.
|
static void |
disable(boolean system)
Invoke this method to disable hardware rendering in the current process.
|
void |
drawRenderNode(RenderNode node)
Draws a particular render node.
|
static void |
dumpProfileData(byte[] data,
FileDescriptor fd) |
static void |
enableForegroundTrimming()
Controls whether or not the hardware renderer should aggressively
trim memory.
|
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
static boolean |
isAvailable()
Indicates whether hardware acceleration is available under any form for
the view hierarchy.
|
void |
notifyFramePending()
Called by
ViewRootImpl when a new performTraverals is scheduled. |
static void |
overrideProperty(String name,
String value) |
void |
removeRenderNode(RenderNode node)
Only especially added render nodes can be removed.
|
void |
serializeDisplayListTree() |
void |
setContentDrawBounds(int left,
int top,
int right,
int bottom)
To avoid unnecessary overdrawing of the main content all additionally passed render nodes
will be prevented to overdraw this area.
|
static void |
setupDiskCache(File cacheDir)
Sets the directory to use as a persistent storage for hardware rendering
resources.
|
static void |
trimMemory(int level)
Invoke this method when the system is running out of memory.
|
public static final String PROFILE_PROPERTY
public static final String PROFILE_PROPERTY_VISUALIZE_BARS
PROFILE_PROPERTY
. When the property is set to this
value, profiling data will be visualized on screen as a bar chart.public static final String DEBUG_DIRTY_REGIONS_PROPERTY
public static final String DEBUG_SHOW_LAYERS_UPDATES_PROPERTY
public static final String DEBUG_OVERDRAW_PROPERTY
public static final String OVERDRAW_PROPERTY_SHOW
DEBUG_OVERDRAW_PROPERTY
. When the property is set to this
value, overdraw will be shown on screen by coloring pixels.public static final String DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY
public static boolean sRendererDisabled
public static boolean sSystemRendererDisabled
public static boolean sTrimForeground
public static void disable(boolean system)
public static void enableForegroundTrimming()
public static boolean isAvailable()
public static void setupDiskCache(File cacheDir)
cacheDir
- A directory the current process can write topublic static ThreadedRenderer create(Context context, boolean translucent)
translucent
- True if the surface is translucent, false otherwisepublic static void trimMemory(int level)
level
- Hint about the amount of memory that should be trimmed,
see ComponentCallbacks
public static void dumpProfileData(byte[] data, FileDescriptor fd)
public void addRenderNode(RenderNode node, boolean placeFront)
node
- The node to add.placeFront
- If true, the render node will be placed in front of the content node,
otherwise behind the content node.public void removeRenderNode(RenderNode node)
node
- The node which was added via addRenderNode which should get removed again.public void drawRenderNode(RenderNode node)
node
- The node to be drawn.public void setContentDrawBounds(int left, int top, int right, int bottom)
left
- The left side of the protected bounds.top
- The top side of the protected bounds.right
- The right side of the protected bounds.bottom
- The bottom side of the protected bounds.public void notifyFramePending()
ViewRootImpl
when a new performTraverals is scheduled.public void serializeDisplayListTree()
protected void finalize() throws Throwable
Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the JavaTM virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.