diff options
| author | 2023-07-27 22:16:26 +0000 | |
|---|---|---|
| committer | 2023-07-27 22:16:26 +0000 | |
| commit | b7cc48ab3b982cda25e9e8eceeadd8317e11b2df (patch) | |
| tree | 5c62fb8db8f001e4e548e68d34823c95c2f44fba | |
| parent | cd35f59c5b28ccf0a1d7e490a30fc2cb08db3c3d (diff) | |
| parent | be2ac9c75328f62456965d764d9e2eb4869cd69e (diff) | |
Merge "RenderEngine: Limit the size of blur input to the display size" into udc-dev am: be2ac9c753
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/24193668
Change-Id: Ief8161d04df8932e2ac461cb6cc784a416878fb4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | libs/renderengine/skia/SkiaRenderEngine.cpp | 14 | 
1 files changed, 13 insertions, 1 deletions
| diff --git a/libs/renderengine/skia/SkiaRenderEngine.cpp b/libs/renderengine/skia/SkiaRenderEngine.cpp index fda6ea189e..76ebf9d0c2 100644 --- a/libs/renderengine/skia/SkiaRenderEngine.cpp +++ b/libs/renderengine/skia/SkiaRenderEngine.cpp @@ -813,8 +813,20 @@ void SkiaRenderEngine::drawLayersInternal(              if (!blurInput) {                  blurInput = activeSurface->makeImageSnapshot();              } +              // rect to be blurred in the coordinate space of blurInput -            const auto blurRect = canvas->getTotalMatrix().mapRect(bounds.rect()); +            SkRect blurRect = canvas->getTotalMatrix().mapRect(bounds.rect()); + +            // Some layers may be much bigger than the screen. If we used +            // `blurRect` directly, this would allocate a large buffer with no +            // benefit. Apply the clip, which already takes the display size +            // into account. The clipped size will then be used to calculate the +            // size of the buffer we will create for blurring. +            if (!blurRect.intersect(SkRect::Make(canvas->getDeviceClipBounds()))) { +                // This should not happen, but if it did, we would use the full +                // sized layer, which should still be fine. +                ALOGW("blur bounds does not intersect display clip!"); +            }              // if the clip needs to be applied then apply it now and make sure              // it is restored before we attempt to draw any shadows. |