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

Commit 5deb9afb authored by John Reck's avatar John Reck Committed by Automerger Merge Worker
Browse files

Merge "Add setBackdropRenderEffect for View and RenderNode." into main am: e93a68ed

parents f62b45fa e93a68ed
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -22443,6 +22443,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    /**
     * Configure the {@link android.graphics.RenderEffect} to apply to the backdrop contents of this
     * View. This will apply a visual effect to the result of the backdrop contents of this View
     * before it is drawn. For example if
     * {@link RenderEffect#createBlurEffect(float, float, RenderEffect, Shader.TileMode)}
     * is provided, the previous content behind this View will be blurred before this View is drawn.
     * @param renderEffect to be applied to the View. Passing null clears the previously configured
     *                     {@link RenderEffect}
     * @hide
     */
    public void setBackdropRenderEffect(@Nullable RenderEffect renderEffect) {
        if (mRenderNode.setBackdropRenderEffect(renderEffect)) {
            invalidateViewProperty(true, true);
        }
    }
    /**
     * Updates the {@link Paint} object used with the current layer (used only if the current
     * layer type is not set to {@link #LAYER_TYPE_NONE}). Changed properties of the Paint
+20 −0
Original line number Diff line number Diff line
@@ -970,6 +970,23 @@ public final class RenderNode {
                renderEffect != null ? renderEffect.getNativeInstance() : 0);
    }

    /**
     * Configure the {@link android.graphics.RenderEffect} to apply to the backdrop contents of
     * this RenderNode. This will apply a visual effect to the result of the backdrop contents
     * of this RenderNode before the RenderNode is drawn into the destination. For example if
     * {@link RenderEffect#createBlurEffect(float, float, RenderEffect, Shader.TileMode)}
     * is provided, the previous content behind this RenderNode will be blurred before the
     * RenderNode is drawn in to the destination.
     * @param renderEffect to be applied to the backdrop contents of this RenderNode. Passing
     *          null clears all previously configured RenderEffects
     * @return True if the value changed, false if the new value was the same as the previous value.
     * @hide
     */
    public boolean setBackdropRenderEffect(@Nullable RenderEffect renderEffect) {
        return nSetBackdropRenderEffect(mNativeRenderNode,
                renderEffect != null ? renderEffect.getNativeInstance() : 0);
    }

    /**
     * Returns the translucency level of this display list.
     *
@@ -1796,6 +1813,9 @@ public final class RenderNode {
    @CriticalNative
    private static native boolean nSetRenderEffect(long renderNode, long renderEffect);

    @CriticalNative
    private static native boolean nSetBackdropRenderEffect(long renderNode, long renderEffect);

    @CriticalNative
    private static native boolean nSetHasOverlappingRendering(long renderNode,
            boolean hasOverlappingRendering);
+1 −0
Original line number Diff line number Diff line
@@ -514,6 +514,7 @@ cc_defaults {
        "canvas/CanvasOpRasterizer.cpp",
        "effects/StretchEffect.cpp",
        "effects/GainmapRenderer.cpp",
        "pipeline/skia/BackdropFilterDrawable.cpp",
        "pipeline/skia/HolePunch.cpp",
        "pipeline/skia/SkiaDisplayList.cpp",
        "pipeline/skia/SkiaRecordingCanvas.cpp",
+6 −0
Original line number Diff line number Diff line
@@ -260,6 +260,12 @@ void RenderNode::prepareTreeImpl(TreeObserver& observer, TreeInfo& info, bool fu
        pushStagingDisplayListChanges(observer, info);
    }

    // always damageSelf when filtering backdrop content, or else the BackdropFilterDrawable will
    // get a wrong snapshot of previous content.
    if (mProperties.layerProperties().getBackdropImageFilter()) {
        damageSelf(info);
    }

    if (mDisplayList) {
        info.out.hasFunctors |= mDisplayList.hasFunctor();
        mHasHolePunches = mDisplayList.hasHolePunches();
+7 −0
Original line number Diff line number Diff line
@@ -55,6 +55,12 @@ bool LayerProperties::setImageFilter(SkImageFilter* imageFilter) {
    return true;
}

bool LayerProperties::setBackdropImageFilter(SkImageFilter* imageFilter) {
    if (mBackdropImageFilter.get() == imageFilter) return false;
    mBackdropImageFilter = sk_ref_sp(imageFilter);
    return true;
}

bool LayerProperties::setFromPaint(const SkPaint* paint) {
    bool changed = false;
    changed |= setAlpha(static_cast<uint8_t>(PaintUtils::getAlphaDirect(paint)));
@@ -70,6 +76,7 @@ LayerProperties& LayerProperties::operator=(const LayerProperties& other) {
    setXferMode(other.xferMode());
    setColorFilter(other.getColorFilter());
    setImageFilter(other.getImageFilter());
    setBackdropImageFilter(other.getBackdropImageFilter());
    mStretchEffect = other.mStretchEffect;
    return *this;
}
Loading