Android P在绘制界面时,默认更换skiagl绘图库绘制界面

Android O和Android P在绘制界面时默认使用的是不同的库进行绘制的

  • Android O是通过使用opengl进行绘制

    • frameworks/base/libs/hwui/Properties.cpp
    RenderPipelineType Properties::getRenderPipelineType() {
        if (sRenderPipelineType != RenderPipelineType::NotInitialized) {
            return sRenderPipelineType;
        }
        char prop[PROPERTY_VALUE_MAX];
        property_get(PROPERTY_RENDERER, prop, "opengl");
        if (!strcmp(prop, "skiagl")) {
            ALOGD("Skia GL Pipeline");
            sRenderPipelineType = RenderPipelineType::SkiaGL;
        } else if (!strcmp(prop, "skiavk")) {
            ALOGD("Skia Vulkan Pipeline");
            sRenderPipelineType = RenderPipelineType::SkiaVulkan;
        } else {  //"opengl"
            ALOGD("HWUI GL Pipeline");
            sRenderPipelineType = RenderPipelineType::OpenGL;
        }
        return sRenderPipelineType;
    }
    
  • Android P是通过使用skiagl进行绘制

    • frameworks/base/libs/hwui/Properties.cpp
    RenderPipelineType Properties::getRenderPipelineType() {
        if (sRenderPipelineType != RenderPipelineType::NotInitialized) {
            return sRenderPipelineType;
        }
        char prop[PROPERTY_VALUE_MAX];
        property_get(PROPERTY_RENDERER, prop, "skiagl");
        if (!strcmp(prop, "skiagl")) {
            ALOGD("Skia GL Pipeline");
            sRenderPipelineType = RenderPipelineType::SkiaGL;
        } else if (!strcmp(prop, "skiavk")) {
            ALOGD("Skia Vulkan Pipeline");
            sRenderPipelineType = RenderPipelineType::SkiaVulkan;
        } else {  //"opengl"
            ALOGD("HWUI GL Pipeline");
            sRenderPipelineType = RenderPipelineType::OpenGL;
        }
        return sRenderPipelineType;
    }
    
  • Android在9.0后的版本中默认使用skiagl替换

你可能感兴趣的:(Android)