summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2023-08-25 00:06:36 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-08-25 00:06:36 +0000
commit92cc6761d7626cb3275257b261feeb8e0076b72f (patch)
tree62f95d7bd1ea3d744c632905c03edab8f51c98ab
parentbb0c28c10bda2a58515a3a588bbc0076ea955778 (diff)
parentaa584a39771e64f6b5ffb4da6e50068b7afe3134 (diff)
Merge "Fix potential thread violation in applying gainmaps" into main
-rw-r--r--libs/hwui/effects/GainmapRenderer.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libs/hwui/effects/GainmapRenderer.cpp b/libs/hwui/effects/GainmapRenderer.cpp
index db58b2bfa273..3ebf7d19202d 100644
--- a/libs/hwui/effects/GainmapRenderer.cpp
+++ b/libs/hwui/effects/GainmapRenderer.cpp
@@ -54,14 +54,13 @@ float getTargetHdrSdrRatio(const SkColorSpace* destColorspace) {
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,