Skip to content

Commit c92fd97

Browse files
Shan HuangAndroid (Google) Code Review
authored andcommitted
Merge "Take the ceil() of the width and height of the new render target." into main
2 parents 8373acb + c1d9a62 commit c92fd97

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

libs/renderengine/skia/filters/KawaseBlurDualFilter.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,12 @@ sk_sp<SkImage> KawaseBlurDualFilter::generate(SkiaGpuContext* context, const uin
118118
const int filterPasses = std::min(kMaxSurfaces - 1, static_cast<int>(ceil(filterDepth)));
119119

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

126129
// Render into surfaces downscaled by 1x, 2x, and 4x from the initial downscale.

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,8 @@ renderengine::RenderEngine::BlurAlgorithm chooseBlurAlgorithm(bool supportsBlur)
879879
return renderengine::RenderEngine::BlurAlgorithm::GAUSSIAN;
880880
} else if (algorithm == "kawase2") {
881881
return renderengine::RenderEngine::BlurAlgorithm::KAWASE_DUAL_FILTER;
882+
} else if (algorithm == "kawase") {
883+
return renderengine::RenderEngine::BlurAlgorithm::KAWASE;
882884
} else {
883885
if (FlagManager::getInstance().window_blur_kawase2()) {
884886
return renderengine::RenderEngine::BlurAlgorithm::KAWASE_DUAL_FILTER;

0 commit comments

Comments
 (0)