summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author chaviw <chaviw@google.com> 2020-07-01 15:53:47 -0700
committer chaviw <chaviw@google.com> 2020-07-21 11:26:55 -0700
commit1ff3d1e3cd851aff1e20fcb8958bbf3784d8f922 (patch)
tree931707079d6f4305e6fce7453c13d8d853386e06 /services/surfaceflinger/Layer.cpp
parentdc07032296a6cd8525b5c7c1648ed7aed6f7769c (diff)
Use Transform in InputDispatcher
Modified InputDispatcher to use the Transform object instead of offset and scale values. Bug: 158476194 Test: /data/nativetest64/inputflinger_tests/inputflinger_tests Test: /data/nativetest64/libinput_tests/libinput_tests Change-Id: I31242fa6af92b02158ccb0d292c208a4a21c9e43
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 70822bd02b..89c95d2846 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2387,17 +2387,8 @@ InputWindowInfo Layer::fillInputInfo() {
}
ui::Transform t = getTransform();
- const float xScale = t.dsdx();
- const float yScale = t.dsdy();
int32_t xSurfaceInset = info.surfaceInset;
int32_t ySurfaceInset = info.surfaceInset;
- if (xScale != 1.0f || yScale != 1.0f) {
- info.windowXScale *= (xScale != 0.0f) ? 1.0f / xScale : 0.0f;
- info.windowYScale *= (yScale != 0.0f) ? 1.0f / yScale : 0.0f;
- info.touchableRegion.scaleSelf(xScale, yScale);
- xSurfaceInset = std::round(xSurfaceInset * xScale);
- ySurfaceInset = std::round(ySurfaceInset * yScale);
- }
// Transform layer size to screen space and inset it by surface insets.
// If this is a portal window, set the touchableRegion to the layerBounds.
@@ -2407,6 +2398,15 @@ InputWindowInfo Layer::fillInputInfo() {
if (!layerBounds.isValid()) {
layerBounds = getCroppedBufferSize(getDrawingState());
}
+
+ const float xScale = t.getScaleX();
+ const float yScale = t.getScaleY();
+ if (xScale != 1.0f || yScale != 1.0f) {
+ info.touchableRegion.scaleSelf(xScale, yScale);
+ xSurfaceInset = std::round(xSurfaceInset * xScale);
+ ySurfaceInset = std::round(ySurfaceInset * yScale);
+ }
+
layerBounds = t.transform(layerBounds);
// clamp inset to layer bounds
@@ -2421,6 +2421,10 @@ InputWindowInfo Layer::fillInputInfo() {
info.frameRight = layerBounds.right;
info.frameBottom = layerBounds.bottom;
+ ui::Transform inputTransform(t);
+ inputTransform.set(layerBounds.left, layerBounds.top);
+ info.transform = inputTransform.inverse();
+
// Position the touchable region relative to frame screen location and restrict it to frame
// bounds.
info.touchableRegion = info.touchableRegion.translate(info.frameLeft, info.frameTop);