Fields Summary |
---|
static final String | LOG_TAG |
private static final String | CACHE_PATH_SHADERSName of the file that holds the shaders cache. |
static final String | RENDER_DIRTY_REGIONS_PROPERTYSystem property used to enable or disable dirty regions invalidation.
This property is only queried if {@link #RENDER_DIRTY_REGIONS} is true.
The default value of this property is assumed to be true.
Possible values:
"true", to enable partial invalidates
"false", to disable partial invalidates |
public static final String | PROFILE_PROPERTYSystem property used to enable or disable hardware rendering profiling.
The default value of this property is assumed to be false.
When profiling is enabled, the adb shell dumpsys gfxinfo command will
output extra information about the time taken to execute by the last
frames.
Possible values:
"true", to enable profiling
"visual_bars", to enable profiling and visualize the results on screen
"false", to disable profiling |
public static final String | PROFILE_PROPERTY_VISUALIZE_BARSValue for {@link #PROFILE_PROPERTY}. When the property is set to this
value, profiling data will be visualized on screen as a bar chart. |
static final String | PROFILE_MAXFRAMES_PROPERTYSystem property used to specify the number of frames to be used
when doing hardware rendering profiling.
The default value of this property is #PROFILE_MAX_FRAMES.
When profiling is enabled, the adb shell dumpsys gfxinfo command will
output extra information about the time taken to execute by the last
frames.
Possible values:
"60", to set the limit of frames to 60 |
static final String | PRINT_CONFIG_PROPERTYSystem property used to debug EGL configuration choice.
Possible values:
"choice", print the chosen configuration only
"all", print all possible configurations |
public static final String | DEBUG_DIRTY_REGIONS_PROPERTYTurn on to draw dirty regions every other frame.
Possible values:
"true", to enable dirty regions debugging
"false", to disable dirty regions debugging |
public static final String | DEBUG_SHOW_LAYERS_UPDATES_PROPERTYTurn on to flash hardware layers when they update.
Possible values:
"true", to enable hardware layers updates debugging
"false", to disable hardware layers updates debugging |
public static final String | DEBUG_OVERDRAW_PROPERTYControls overdraw debugging.
Possible values:
"false", to disable overdraw debugging
"show", to show overdraw areas on screen
"count", to display an overdraw counter |
public static final String | OVERDRAW_PROPERTY_SHOWValue for {@link #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_PROPERTYTurn on to debug non-rectangular clip operations.
Possible values:
"hide", to disable this debug mode
"highlight", highlight drawing commands tested against a non-rectangular clip
"stencil", renders the clip region on screen when set |
public static boolean | sRendererDisabledA process can set this flag to false to prevent the use of hardware
rendering. |
public static boolean | sSystemRendererDisabledFurther hardware renderer disabling for the system process. |
private boolean | mEnabled |
private boolean | mRequested |
public static boolean | sTrimForeground |
Methods Summary |
---|
abstract void | buildLayer(RenderNode node)
|
abstract boolean | copyLayerInto(HardwareLayer layer, android.graphics.Bitmap bitmap)
|
static android.view.HardwareRenderer | create(android.content.Context context, boolean translucent)Creates a hardware renderer using OpenGL.
HardwareRenderer renderer = null;
if (GLES20Canvas.isAvailable()) {
renderer = new ThreadedRenderer(context, translucent);
}
return renderer;
|
abstract HardwareLayer | createTextureLayer()Creates a new hardware layer. A hardware layer built by calling this
method will be treated as a texture layer, instead of as a render target.
|
abstract void | destroy()Destroys the hardware rendering context.
|
abstract void | destroyHardwareResources(View view)Destroys all hardware rendering resources associated with the specified
view hierarchy.
|
abstract void | detachSurfaceTexture(long hardwareLayer)Detaches the layer's surface texture from the GL context and releases
the texture id
|
public static void | disable(boolean system)Invoke this method to disable hardware rendering in the current process.
sRendererDisabled = true;
if (system) {
sSystemRendererDisabled = true;
}
|
abstract void | draw(View view, View.AttachInfo attachInfo, android.view.HardwareRenderer$HardwareDrawCallbacks callbacks)Draws the specified view.
|
abstract void | dumpGfxInfo(java.io.PrintWriter pw, java.io.FileDescriptor fd)Outputs extra debugging information in the specified file descriptor.
|
public static void | enableForegroundTrimming()Controls whether or not the hardware renderer should aggressively
trim memory. Note that this must not be set for any process that
uses WebView! This should be only used by system_process or similar
that do not go into the background.
sTrimForeground = true;
|
abstract void | fence()Blocks until all previously queued work has completed.
|
abstract int | getHeight()Gets the current height of the surface. This is the height that the surface
was last set to in a call to {@link #setup(int, int, Rect)}.
|
abstract int | getWidth()Gets the current width of the surface. This is the width that the surface
was last set to in a call to {@link #setup(int, int, Rect)}.
|
abstract boolean | initialize(Surface surface)Initializes the hardware renderer for the specified surface.
|
boolean | initializeIfNeeded(int width, int height, Surface surface, android.graphics.Rect surfaceInsets)Initializes the hardware renderer for the specified surface and setup the
renderer for drawing, if needed. This is invoked when the ViewAncestor has
potentially lost the hardware renderer. The hardware renderer should be
reinitialized and setup when the render {@link #isRequested()} and
{@link #isEnabled()}.
if (isRequested()) {
// We lost the gl context, so recreate it.
if (!isEnabled()) {
if (initialize(surface)) {
setup(width, height, surfaceInsets);
return true;
}
}
}
return false;
|
abstract void | invalidate(Surface surface)This method should be invoked whenever the current hardware renderer
context should be reset.
|
abstract void | invalidateRoot()Indicates that the content drawn by HardwareDrawCallbacks needs to
be updated, which will be done by the next call to draw()
|
public static boolean | isAvailable()Indicates whether hardware acceleration is available under any form for
the view hierarchy.
return GLES20Canvas.isAvailable();
|
boolean | isEnabled()Indicates whether hardware acceleration is currently enabled.
return mEnabled;
|
boolean | isRequested()Indicates whether hardware acceleration is currently request but not
necessarily enabled yet.
return mRequested;
|
abstract boolean | loadSystemProperties()Loads system properties used by the renderer. This method is invoked
whenever system properties are modified. Implementations can use this
to trigger live updates of the renderer based on properties.
|
abstract void | notifyFramePending()Called by {@link ViewRootImpl} when a new performTraverals is scheduled.
|
abstract void | onLayerDestroyed(HardwareLayer layer)Tells the HardwareRenderer that the layer is destroyed. The renderer
should remove the layer from any update queues.
|
abstract boolean | pauseSurface(Surface surface)Stops any rendering into the surface. Use this if it is unclear whether
or not the surface used by the HardwareRenderer will be changing. It
Suspends any rendering into the surface, but will not do any destruction
|
abstract void | pushLayerUpdate(HardwareLayer layer)Indicates that the specified hardware layer needs to be updated
as soon as possible.
|
abstract void | registerAnimatingRenderNode(RenderNode animator)
|
void | setEnabled(boolean enabled)Indicates whether hardware acceleration is currently enabled.
mEnabled = enabled;
|
abstract void | setName(java.lang.String name)Optional, sets the name of the renderer. Useful for debugging purposes.
|
abstract void | setOpaque(boolean opaque)Change the HardwareRenderer's opacity
|
void | setRequested(boolean requested)Indicates whether hardware acceleration is currently requested but not
necessarily enabled yet.
mRequested = requested;
|
abstract void | setup(int width, int height, android.graphics.Rect surfaceInsets)Sets up the renderer for drawing.
|
public static void | setupDiskCache(java.io.File cacheDir)Sets the directory to use as a persistent storage for hardware rendering
resources.
ThreadedRenderer.setupShadersDiskCache(new File(cacheDir, CACHE_PATH_SHADERS).getAbsolutePath());
|
abstract void | stopDrawing()Prevents any further drawing until draw() is called. This is a signal
that the contents of the RenderNode tree are no longer safe to play back.
In practice this usually means that there are Functor pointers in the
display list that are no longer valid.
|
static void | trimMemory(int level)Invoke this method when the system is running out of memory. This
method will attempt to recover as much memory as possible, based on
the specified hint.
ThreadedRenderer.trimMemory(level);
|
abstract void | updateSurface(Surface surface)Updates the hardware renderer for the specified surface.
|