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

Commit 39feade9 authored by Derek Sollenberger's avatar Derek Sollenberger
Browse files

Ensure that blurRegions take into account the buffers rotation.

Some tranformations are applied to content rendered into a buffer that
are unknown to the UI (e.g. Android View) that drew it. That is the case
for blurRegions so we must provide a matrix that translates the contents
of the blurRegion into the same coordinate space used by the other
geometry in RenderEngine's LayerSettings.

Bug: 185228719
Test: atest librenderengine_test and SilkFX demo
Change-Id: I4e3144bac678ffff2f29f3270d589e9f3fe94634
parent 3395218c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -156,6 +156,10 @@ struct LayerSettings {

    std::vector<BlurRegion> blurRegions;

    // Transform matrix used to convert the blurRegions geometry into the same
    // coordinate space as LayerSettings.geometry
    mat4 blurRegionTransform = mat4();

    StretchEffect stretchEffect;

    // Name associated with the layer for debugging purposes.
+2 −0
Original line number Diff line number Diff line
@@ -834,6 +834,8 @@ status_t SkiaGLRenderEngine::drawLayers(const DisplaySettings& display,
                    mBlurFilter->drawBlurRegion(canvas, getBlurRegion(layer), blurRect,
                                                blurredImage, blurInput);
                }
                SkAutoCanvasRestore acr(canvas, true);
                canvas->concat(getSkM44(layer->blurRegionTransform).asM33());
                for (auto region : layer->blurRegions) {
                    if (cachedBlurs[region.blurRadius] == nullptr) {
                        ATRACE_NAME("BlurRegion");
+2 −0
Original line number Diff line number Diff line
@@ -632,6 +632,8 @@ std::optional<compositionengine::LayerFE::LayerSettings> Layer::prepareClientCom
    if (!targetSettings.disableBlurs) {
        layerSettings.backgroundBlurRadius = getBackgroundBlurRadius();
        layerSettings.blurRegions = getBlurRegions();
        layerSettings.blurRegionTransform =
                getActiveTransform(getDrawingState()).inverse().asMatrix4();
    }
    layerSettings.stretchEffect = getDrawingState().stretchEffect;
    // Record the name of the layer for debugging further down the stack.