From e0acf3825a6a6f746295079f77fbcea0a7046b8b Mon Sep 17 00:00:00 2001 From: Galia Peycheva Date: Mon, 12 Apr 2021 21:22:34 +0200 Subject: Make blur regions alpha depend on layer alpha Bug: 183109337 Test: m && flash && check blur region alpha animating Change-Id: I17032051909c12aab60225a080b7431e0b35814a --- services/surfaceflinger/Layer.cpp | 9 +++++++-- services/surfaceflinger/Layer.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 94fd62fa7a..3557fa71bd 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -2264,8 +2264,13 @@ int32_t Layer::getBackgroundBlurRadius() const { return parentAlpha * getDrawingState().backgroundBlurRadius; } -const std::vector& Layer::getBlurRegions() const { - return getDrawingState().blurRegions; +const std::vector Layer::getBlurRegions() const { + auto regionsCopy(getDrawingState().blurRegions); + int layerAlpha = getAlpha(); + for (auto& region : regionsCopy) { + region.alpha = region.alpha * layerAlpha; + } + return regionsCopy; } Layer::RoundedCornerState Layer::getRoundedCornerState() const { diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 3a45c949a4..a2a0da1d17 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -1192,7 +1192,7 @@ private: float mEffectiveShadowRadius = 0.f; // A list of regions on this layer that should have blurs. - const std::vector& getBlurRegions() const; + const std::vector getBlurRegions() const; }; std::ostream& operator<<(std::ostream& stream, const Layer::FrameRate& rate); -- cgit v1.2.3-59-g8ed1b