之前讨论过skia codec部分在o,p上的变化,比如增加了heif解码等。
其实skia在android o,p的变化不只这些。
印象最深刻的还是渲染部分
从o开始hwui渲染支持skia opengl,原来hwui只支持opengl渲染,只不过在o里,skia opengl是可选的方式,默认还是opengl,但在p上已经默认采用skia opengl了,而且去掉了选择。
Android o上的选项
Android O上相关的代码
/**
* Defines the rendering pipeline to be used by the ThreadedRenderer.
*
* Possible values:
* "opengl", will use the existing OpenGL renderer
* "skiagl", will use Skia's OpenGL renderer
* "skiavk", will use Skia's Vulkan renderer
*
* @hide
*/
public static final String DEBUG_RENDERER_PROPERTY = "debug.hwui.renderer";
上边定义了可选的几个选项,是不是看到了vulkan,看来android早有打算
Readback& RenderThread::readback() {
if (!mReadback) {
auto renderType = Properties::getRenderPipelineType();
switch (renderType) {
case RenderPipelineType::OpenGL:
mReadback = new OpenGLReadbackImpl(*this);