diff --git a/libs/hwui/effects/GainmapRenderer.cpp b/libs/hwui/effects/GainmapRenderer.cpp index a544ae88f9bef..8977d3ce4da33 100644 --- a/libs/hwui/effects/GainmapRenderer.cpp +++ b/libs/hwui/effects/GainmapRenderer.cpp @@ -48,10 +48,7 @@ void DrawGainmapBitmap(SkCanvas* c, const sk_sp& image, const SkR gainmapSrc.fRight *= sX; gainmapSrc.fTop *= sY; gainmapSrc.fBottom *= sY; - // TODO: Temporary workaround for SkGainmapShader::Make not having a const variant - sk_sp mutImage = sk_ref_sp(const_cast(image.get())); - sk_sp mutGainmap = sk_ref_sp(const_cast(gainmapImage.get())); - auto shader = SkGainmapShader::Make(mutImage, src, sampling, mutGainmap, gainmapSrc, + auto shader = SkGainmapShader::Make(image, src, sampling, gainmapImage, gainmapSrc, sampling, gainmapInfo, dst, targetSdrHdrRatio, c->imageInfo().refColorSpace()); gainmapPaint.setShader(shader); diff --git a/tests/SilkFX/Android.bp b/tests/SilkFX/Android.bp index 088d9a2d7f412..1e467db445457 100644 --- a/tests/SilkFX/Android.bp +++ b/tests/SilkFX/Android.bp @@ -25,13 +25,17 @@ package { android_test { name: "SilkFX", - srcs: ["**/*.java", "**/*.kt"], + srcs: [ + "**/*.java", + "**/*.kt", + ], platform_apis: true, certificate: "platform", - static_libs: [ + static_libs: [ "androidx.core_core", "androidx.appcompat_appcompat", "com.google.android.material_material", "androidx-constraintlayout_constraintlayout", + "subsampling-scale-image-view", ], } diff --git a/tests/SilkFX/AndroidManifest.xml b/tests/SilkFX/AndroidManifest.xml index 21256d8c9d0bb..1b8e08bd009f3 100644 --- a/tests/SilkFX/AndroidManifest.xml +++ b/tests/SilkFX/AndroidManifest.xml @@ -55,5 +55,15 @@ android:exported="true"> + + + + + + + + diff --git a/tests/SilkFX/assets/gainmaps/cave.jpg b/tests/SilkFX/assets/gainmaps/cave.jpg new file mode 100644 index 0000000000000..fa7d3fc325d57 Binary files /dev/null and b/tests/SilkFX/assets/gainmaps/cave.jpg differ diff --git a/tests/SilkFX/res/drawable-nodpi/blue_sweep_gradient.xml b/tests/SilkFX/res/drawable-nodpi/blue_sweep_gradient.xml new file mode 100644 index 0000000000000..c183c5deab4f5 --- /dev/null +++ b/tests/SilkFX/res/drawable-nodpi/blue_sweep_gradient.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/tests/SilkFX/res/drawable-nodpi/dark_gradient.xml b/tests/SilkFX/res/drawable-nodpi/dark_gradient.xml new file mode 100644 index 0000000000000..d2653d0de0d4f --- /dev/null +++ b/tests/SilkFX/res/drawable-nodpi/dark_gradient.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/tests/SilkFX/res/drawable-nodpi/green_sweep_gradient.xml b/tests/SilkFX/res/drawable-nodpi/green_sweep_gradient.xml new file mode 100644 index 0000000000000..c600d0f663256 --- /dev/null +++ b/tests/SilkFX/res/drawable-nodpi/green_sweep_gradient.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/tests/SilkFX/res/drawable-nodpi/grey_sweep_gradient.xml b/tests/SilkFX/res/drawable-nodpi/grey_sweep_gradient.xml new file mode 100644 index 0000000000000..d0c17fa2e1b9d --- /dev/null +++ b/tests/SilkFX/res/drawable-nodpi/grey_sweep_gradient.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/tests/SilkFX/res/drawable-nodpi/light_gradient.xml b/tests/SilkFX/res/drawable-nodpi/light_gradient.xml new file mode 100644 index 0000000000000..c75f925647e7a --- /dev/null +++ b/tests/SilkFX/res/drawable-nodpi/light_gradient.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/tests/SilkFX/res/drawable-nodpi/red_sweep_gradient.xml b/tests/SilkFX/res/drawable-nodpi/red_sweep_gradient.xml new file mode 100644 index 0000000000000..e3b834a464067 --- /dev/null +++ b/tests/SilkFX/res/drawable-nodpi/red_sweep_gradient.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/tests/SilkFX/res/layout/color_grid.xml b/tests/SilkFX/res/layout/color_grid.xml new file mode 100644 index 0000000000000..37242eee7195d --- /dev/null +++ b/tests/SilkFX/res/layout/color_grid.xml @@ -0,0 +1,20 @@ + + + + diff --git a/tests/SilkFX/res/layout/common_base.xml b/tests/SilkFX/res/layout/common_base.xml index 944c6846fbf74..c0eaf9bc14762 100644 --- a/tests/SilkFX/res/layout/common_base.xml +++ b/tests/SilkFX/res/layout/common_base.xml @@ -24,16 +24,6 @@ - - - - + android:layout_height="match_parent" /> \ No newline at end of file diff --git a/tests/SilkFX/res/layout/gainmap_decode_test.xml b/tests/SilkFX/res/layout/gainmap_decode_test.xml new file mode 100644 index 0000000000000..e7ef61f8dac12 --- /dev/null +++ b/tests/SilkFX/res/layout/gainmap_decode_test.xml @@ -0,0 +1,115 @@ + + + + + + + +