Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1d9a62f authored by Shan Huang's avatar Shan Huang
Browse files

Take the ceil() of the width and height of the new render target.

This was removed in ag/31004652 by mistake and might be causing the null pointer exception in 387410516.

Also re-enable setting blur algorithm to KAWASE for testing.

Bug: 387410516
Test: atest BlurTests
Flag: com.android.graphics.surfaceflinger.flags.window_blur_kawase2
Change-Id: I08e53b1eac4f649a76afc21881609fe6abd2337b
parent edc71465
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -118,9 +118,12 @@ sk_sp<SkImage> KawaseBlurDualFilter::generate(SkiaGpuContext* context, const uin
    const int filterPasses = std::min(kMaxSurfaces - 1, static_cast<int>(ceil(filterDepth)));

    auto makeSurface = [&](float scale) -> sk_sp<SkSurface> {
        const auto newW = static_cast<float>(blurRect.width() / scale);
        const auto newH = static_cast<float>(blurRect.height() / scale);
        return context->createRenderTarget(input->imageInfo().makeWH(newW, newH));
        const auto newW = ceil(static_cast<float>(blurRect.width() / scale));
        const auto newH = ceil(static_cast<float>(blurRect.height() / scale));
        sk_sp<SkSurface> surface =
                context->createRenderTarget(input->imageInfo().makeWH(newW, newH));
        LOG_ALWAYS_FATAL_IF(!surface, "%s: Failed to create surface for blurring!", __func__);
        return surface;
    };

    // Render into surfaces downscaled by 1x, 2x, and 4x from the initial downscale.
+2 −0
Original line number Diff line number Diff line
@@ -879,6 +879,8 @@ renderengine::RenderEngine::BlurAlgorithm chooseBlurAlgorithm(bool supportsBlur)
        return renderengine::RenderEngine::BlurAlgorithm::GAUSSIAN;
    } else if (algorithm == "kawase2") {
        return renderengine::RenderEngine::BlurAlgorithm::KAWASE_DUAL_FILTER;
    } else if (algorithm == "kawase") {
        return renderengine::RenderEngine::BlurAlgorithm::KAWASE;
    } else {
        if (FlagManager::getInstance().window_blur_kawase2()) {
            return renderengine::RenderEngine::BlurAlgorithm::KAWASE_DUAL_FILTER;