Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hwrdr.native] Blur RenderEffect seems to always use DECAL edge treatment #8955

Open
chrisbanes opened this issue Mar 30, 2024 · 4 comments
Open

Comments

@chrisbanes
Copy link

chrisbanes commented Mar 30, 2024

Description

I'm trying out the new hardware native renderer in Robolectric, through Roborazzi: chrisbanes/haze#147. You'll notice that the blurred content has a white edge around it.

This is what the same content looks like on device:

Screenshot_1711787974

The issue seems to be that I use RenderEffect.createBlurEffect(..., Shader.TileMode.CLAMP) (here). Robolectric seems to ignore the tile mode provided, and forces the DECAL mode.

For completeness, this is what is displayed on device when I switch to DECAL, which is consistent with the screenshot output:

Expected (Device using CLAMP) Observed: Robolectric Device using DECAL
Screenshot_1711787974 Haze Screenshot Test Credit Card Screenshot_1711787988

Robolectric & Android Version

Robolectric 4.12

Link to a public git repo demonstrating the problem:

chrisbanes/haze#147

@hoisie
Copy link
Contributor

hoisie commented Mar 30, 2024

Cc @ralf-at-android

@hoisie
Copy link
Contributor

hoisie commented Apr 3, 2024

Hi Chris,

It looks like, for the current version of native graphics in Robolectric (derived from Android S), blur effect is a GPU-only effect, and does not have a CPU implementation. There is a comment in SKia to this effect, // TODO: Implement CPU backend for different fTileMode.

https://android.googlesource.com/platform/external/skia/+/refs/heads/android12-dev/src/effects/imagefilters/SkBlurImageFilter.cpp#408

There is good news, however. In Android V, there appears to be an implementation of fTileMode for the CPU. So when Android V is released this should start working, if your screenshots target Android V. This is because starting in Android V, Robolectric will use the native libraries built from that specific platform version.

If the fix backports cleanly, we may be able to CP the change from V to RNG's AOSP branch.

@hoisie
Copy link
Contributor

hoisie commented Apr 3, 2024

Here is the equivalent issue in the LayoutLib tracker: https://issuetracker.google.com/issues/326101779

@chrisbanes
Copy link
Author

Great detective work! Thanks for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants