Fix color sampling for landscape
Region sampling listener accepts coordinates already in the correct orientation, no additional transforms are needed.
Bug: 178777512
Test: download Google I/O 2019 app, check system gesture navigation bar
color
Change-Id: I73f78a2a8390beb29b7ab33b2bed2b0326d367b1
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index 653aca6..aa2fec5 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -287,33 +287,12 @@
descriptors.emplace_back(descriptor);
}
- auto dx = 0;
- auto dy = 0;
- switch (orientation) {
- case ui::Transform::ROT_90:
- dx = displaySize.getWidth();
- break;
- case ui::Transform::ROT_180:
- dx = displaySize.getWidth();
- dy = displaySize.getHeight();
- break;
- case ui::Transform::ROT_270:
- dy = displaySize.getHeight();
- break;
- default:
- break;
- }
-
- ui::Transform t(orientation);
- auto screencapRegion = t.transform(sampleRegion);
- screencapRegion = screencapRegion.translate(dx, dy);
-
const Rect sampledBounds = sampleRegion.bounds();
+ constexpr bool kUseIdentityTransform = false;
SurfaceFlinger::RenderAreaFuture renderAreaFuture = ftl::defer([=] {
- return DisplayRenderArea::create(displayWeak, screencapRegion.bounds(),
- sampledBounds.getSize(), ui::Dataspace::V0_SRGB,
- orientation);
+ return DisplayRenderArea::create(displayWeak, sampledBounds, sampledBounds.getSize(),
+ ui::Dataspace::V0_SRGB, kUseIdentityTransform);
});
std::unordered_set<sp<IRegionSamplingListener>, SpHash<IRegionSamplingListener>> listeners;