Merge "Fix potential thread violation in applying gainmaps" into udc-qpr-dev am: 7e9773de36
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24526679
Change-Id: I8fe08409242831d734ef820b70a85b71f1e33c59
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libs/hwui/effects/GainmapRenderer.cpp b/libs/hwui/effects/GainmapRenderer.cpp
index 613f52b..651d526 100644
--- a/libs/hwui/effects/GainmapRenderer.cpp
+++ b/libs/hwui/effects/GainmapRenderer.cpp
@@ -54,14 +54,13 @@
return maxPQLux / GenericSdrWhiteNits;
} else if (skcms_TransferFunction_isHLGish(&destTF)) {
return maxHLGLux / GenericSdrWhiteNits;
- } else {
#ifdef __ANDROID__
+ } else if (RenderThread::isCurrent()) {
CanvasContext* context = CanvasContext::getActiveContext();
return context ? context->targetSdrHdrRatio() : 1.f;
-#else
- return 1.f;
#endif
}
+ return 1.f;
}
void DrawGainmapBitmap(SkCanvas* c, const sk_sp<const SkImage>& image, const SkRect& src,