Android graphic Architecture Analysis Summary
The implementation scheme mainly includes the following key points:
1
, Direct
Framebuffer
And
Framebuffer
Dual-Cache Technology
Without the use of solutions such as x-server, you can directly operate framebuffer to reduce the communication overhead caused by X-server. Open framebuffer and create two buffers (one is on screen front buffer and the other is back buffer, which may be in offscreen framebuffer or system memory ). In the source code, swapbuffers copies the back buffer content to the front buffer. The dual-cache technology allows you to draw in the back buffer, and then copy it to the front buffer for merging and display.
2
, Make full use
OpenGL
Graphical interface and hardware acceleration
Pass
OpenGL
Of
API
,
Android
High-performance
3D
Image.
OpenGL
Of
EGL
Interface, yes
OpenGL
Es
And underlying
Native
Interfaces between platform Windows systems.
3
Image Display cropping and local refresh
Multiple
Layer
Is defined as a layer vector.
Layervector
It contains all
Surface
Corresponding
Layer
,
Surfaceflinger
Based on each
Layer
Of
Z-order
Combine multiple layers into one that is finally displayed on the screen
Buffer
.
Z-order
:
Z
Order actually defines the cascade order between windows. Speaking of"
Z
The name is relative to the screen coordinate. Generally, all windows on the screen have a coordinate system, that is, the origin is in the upper left corner,
X
Axis horizontal to the right,
Y
Coordinates of the vertical and downward axes.
Z
The order is relative to a hypothetical
Z
For the axis, this
Z
The axis points out of the screen. The window is in this
Z
The value on the axis determines its
Z
.
Z
Window with a large order value, Overwrite
Z
Window with a small order value.
In the layer vector, each layer corresponds to
Z
Order value. At the same time, you can set the priority for the layer so that some layers can achieve front-end display. Finally, you can use the corresponding cropping algorithm to calculate the area that can be displayed.
Optimized re-painting mechanism: the local refresh mechanism is adopted, not every time
Repaint
The entire screen needs to be re-painted. First, the area to be re-painted (
Minvalidregion
), If
Displayhardware: update_on_demand
You can set the border of the area to be repainted to perform partial re-painting.
4
Easy-to-use graphic primitives, event mechanisms, and controls
Android. Graphics,
Android. View
And
Android. widget
Functions and other similar graphics libraries such
QT/GTK +
Provides basic graphic primitives (such as drawing points and draw lines, setting graphical context), event mechanisms, and controls for developing graphical user interfaces.
5
And powerful functions
2d
Graphics engine Library
Skia
Yes
2d
Vector graphics processing function library, including fonts, coordinate transformations, and bitmaps, all of which are efficient and concise. It encapsulates the underlying graphics hardware and provides the most basic graphic hardware primitive for the above graphics library. Not only
Google
Chrome
Browser,
Skia
Processing as a drawing, matching
OpenGL/es
Enhance the display effect with specific hardware features.