Support gainmap HW copy.
- for Bitmap::allocateHardwareBitmap to create and upload a hardware
version of the gainmap.
Bug: 267216439
Test: android.graphics.cts.BitmapFactoryTest,
android.graphics.cts.BitmapRegionDecoderTest,
android.graphics.cts.ImageDecoderTest, android.graphics.cts.GainmapTest
Change-Id: Ie080896425dc82a605b2bc41e97ddc2420f5328a
diff --git a/libs/hwui/jni/BitmapFactory.cpp b/libs/hwui/jni/BitmapFactory.cpp
index 571ab83..c57e6f0 100644
--- a/libs/hwui/jni/BitmapFactory.cpp
+++ b/libs/hwui/jni/BitmapFactory.cpp
@@ -637,7 +637,10 @@
return nullObjectReturn("Failed to allocate a hardware bitmap");
}
if (hasGainmap) {
- hardwareBitmap->setGainmap(std::move(gainmap));
+ auto gm = uirenderer::Gainmap::allocateHardwareGainmap(gainmap);
+ if (gm) {
+ hardwareBitmap->setGainmap(std::move(gm));
+ }
}
return bitmap::createBitmap(env, hardwareBitmap.release(), bitmapCreateFlags,