surfaceflinger: fix screenshot dataspace under WCG
Commit a252d8958 (Use GraphicBuffer instead of GBP for screenshots)
removed the ability to query the dataspace of the screenshots. WM
assumes they are sRGB anyway. Let's force screenshots to be in
sRGB.
Bug: 79547689
Test: no color shift during Photos rotation
Change-Id: If57cba1b5a50c4e1f9b305af39d9588b3dd1775d
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index c687e9d..8148bd7 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4810,12 +4810,6 @@
return mCrop;
}
}
- bool getWideColorSupport() const override { return false; }
- Dataspace getDataSpace() const override { return Dataspace::UNKNOWN; }
- float getDisplayMaxLuminance() const override {
- return DisplayDevice::sDefaultMaxLumiance;
- }
-
class ReparentForDrawing {
public:
const sp<Layer>& oldParent;
@@ -5013,12 +5007,9 @@
ALOGE("Invalid crop rect: b = %d (> %d)", sourceCrop.bottom, raHeight);
}
- Dataspace outputDataspace = Dataspace::UNKNOWN;
- if (renderArea.getWideColorSupport()) {
- outputDataspace = renderArea.getDataSpace();
- }
- engine.setOutputDataSpace(outputDataspace);
- engine.setDisplayMaxLuminance(renderArea.getDisplayMaxLuminance());
+ // assume ColorMode::SRGB / RenderIntent::COLORIMETRIC
+ engine.setOutputDataSpace(Dataspace::SRGB);
+ engine.setDisplayMaxLuminance(DisplayDevice::sDefaultMaxLumiance);
// make sure to clear all GL error flags
engine.checkErrors();