diff options
author | 2024-11-15 22:54:49 +0000 | |
---|---|---|
committer | 2024-11-15 23:02:22 +0000 | |
commit | 18682dc6f75c6164afe319ccac6cb61c71855e6c (patch) | |
tree | b1e1d2900ca3771782a3b54d417c13c1462d18e4 /graphics/java | |
parent | 7bc0eb3b32bef3bdcefc2f0271f754328b5b8b39 (diff) |
fix incorrect casting for child color filters
Flag: com.android.graphics.hwui.flags.runtime_color_filters_blenders
Test: atest
CtsUiRenderingTestCases:RuntimeShaderTests
CtsUiRenderingTestCases:RuntimeColorFilterTests
CtsUiRenderingTestCases:RuntimeXfermodeTests
Bug: b/358126864 b/379193391
Change-Id: Ic0a92c18075e1fd9f07080c2b9a7a795e541cdee
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/graphics/RuntimeColorFilter.java | 6 | ||||
-rw-r--r-- | graphics/java/android/graphics/RuntimeShader.java | 11 | ||||
-rw-r--r-- | graphics/java/android/graphics/RuntimeXfermode.java | 4 |
3 files changed, 17 insertions, 4 deletions
diff --git a/graphics/java/android/graphics/RuntimeColorFilter.java b/graphics/java/android/graphics/RuntimeColorFilter.java index d112f7153fca..a64acfe767a9 100644 --- a/graphics/java/android/graphics/RuntimeColorFilter.java +++ b/graphics/java/android/graphics/RuntimeColorFilter.java @@ -280,7 +280,8 @@ public class RuntimeColorFilter extends ColorFilter { if (colorFilter == null) { throw new NullPointerException("The colorFilter parameter must not be null"); } - nativeUpdateChild(getNativeInstance(), filterName, colorFilter.getNativeInstance()); + nativeUpdateInputColorFilter(getNativeInstance(), filterName, + colorFilter.getNativeInstance()); } /** @@ -318,5 +319,6 @@ public class RuntimeColorFilter extends ColorFilter { long colorFilter, String uniformName, int value1, int value2, int value3, int value4, int count); private static native void nativeUpdateChild(long colorFilter, String childName, long child); - + private static native void nativeUpdateInputColorFilter(long colorFilter, String childName, + long inputFilter); } diff --git a/graphics/java/android/graphics/RuntimeShader.java b/graphics/java/android/graphics/RuntimeShader.java index 6316c1fb8b47..3543e991924e 100644 --- a/graphics/java/android/graphics/RuntimeShader.java +++ b/graphics/java/android/graphics/RuntimeShader.java @@ -264,6 +264,9 @@ public class RuntimeShader extends Shader { * enable better heap tracking & tooling support */ private ArrayMap<String, Shader> mShaderUniforms = new ArrayMap<>(); + private ArrayMap<String, ColorFilter> mColorFilterUniforms = new ArrayMap<>(); + private ArrayMap<String, RuntimeXfermode> mXfermodeUniforms = new ArrayMap<>(); + /** * Creates a new RuntimeShader. @@ -544,8 +547,10 @@ public class RuntimeShader extends Shader { if (colorFilter == null) { throw new NullPointerException("The colorFilter parameter must not be null"); } - nativeUpdateChild(mNativeInstanceRuntimeShaderBuilder, filterName, + mColorFilterUniforms.put(filterName, colorFilter); + nativeUpdateColorFilter(mNativeInstanceRuntimeShaderBuilder, filterName, colorFilter.getNativeInstance()); + discardNativeInstance(); } /** @@ -563,8 +568,10 @@ public class RuntimeShader extends Shader { if (xfermode == null) { throw new NullPointerException("The xfermode parameter must not be null"); } + mXfermodeUniforms.put(xfermodeName, xfermode); nativeUpdateChild(mNativeInstanceRuntimeShaderBuilder, xfermodeName, xfermode.createNativeInstance()); + discardNativeInstance(); } @@ -594,6 +601,8 @@ public class RuntimeShader extends Shader { int value4, int count); private static native void nativeUpdateShader( long shaderBuilder, String shaderName, long shader); + private static native void nativeUpdateColorFilter( + long shaderBuilder, String colorFilterName, long colorFilter); private static native void nativeUpdateChild( long shaderBuilder, String childName, long child); } diff --git a/graphics/java/android/graphics/RuntimeXfermode.java b/graphics/java/android/graphics/RuntimeXfermode.java index 51d97a4b7487..c8a0b1a11339 100644 --- a/graphics/java/android/graphics/RuntimeXfermode.java +++ b/graphics/java/android/graphics/RuntimeXfermode.java @@ -285,7 +285,8 @@ public class RuntimeXfermode extends Xfermode { if (colorFilter == null) { throw new NullPointerException("The colorFilter parameter must not be null"); } - nativeUpdateChild(mBuilderNativeInstance, filterName, colorFilter.getNativeInstance()); + nativeUpdateColorFilter(mBuilderNativeInstance, filterName, + colorFilter.getNativeInstance()); } /** @@ -325,5 +326,6 @@ public class RuntimeXfermode extends Xfermode { long builder, String uniformName, int value1, int value2, int value3, int value4, int count); private static native void nativeUpdateChild(long builder, String childName, long child); + private static native void nativeUpdateColorFilter(long builder, String childName, long filter); } |