This CL also updates the documenation to make it clear that the API
returns in local space, not clipped to the size of the bitmap/device.
bug: 8747526
Change-Id: I389844672ce955341863f9940c3b401ab00dc1dc
In these cases the caller passes in a NULL bitmap and expects it
to clear the canvas state. This change preserves that behavior.
bug: 8738494
Change-Id: I7ebf6a74bab3c2822849a3404de3828fec8d3084
When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.
This CL introduces an asset server that provides an atlas to all processes.
Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.
WHAT IS THE ASSETS ATLAS
The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)
HOW IS THE ASSETS ATLAS GENERATED
Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.
There are several steps that lead to the atlas generation:
1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas
2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.
3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.
HOW PROCESSES USE THE ATLAS
Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.
It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)
Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.
Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
bug 8656887
This hides the methods used to support Camera
Fixes the oversight in LaunchControl
Documents some missing functions
Change-Id: I5b19b65dd5ddf9917100192c180bb63d89c80679
Bug: 7343201
This error type is less severe when running under the debug context,
allowing developers to use RSErrorHandler to respond to errors like
out-of-bounds native accesses.
Change-Id: I79c87d1956c94833546f0f638ffa1aafecae49cd
This is not quite a straight revery, some manual edits were necessary.
The original CL didn't undergo sufficient design review or testing. Revert until the regressions can be sorted out.
Bug 8585185
This reverts commit 6dacf8355a0692b52c49f603f43317772cb36175
This reverts commit f8c033db1edf36a0ab09568c3142054f0be2d1a1
Change-Id: Ie7215bdf881332e822603547e92f810f595077fc
- fix DrawableContainerState.getChangingConfigurations() to take care about its children
- make Resources.verifyPreloadConfig() return false when the changing configuration
contains layout direction bits (this is when a Drawable is having different version
for LTR and RTL layout directions)
- use constant state instead of the resource type value for checking if we can
preload the drawable
- fix typo
Change-Id: Idd64caf0fbe0f5cfd5ffe09343e84bafa9446ea5