From 39d4aa5bb18a14680347f6f6d1a34eed918e274b Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Fri, 30 Nov 2018 20:46:53 +0800 Subject: Fix empty region if the scale is smaller than 1 It may be used by Layer of SurfaceFlinger to calculate touchable region. It should be able to scale a window to a smaller size. Bug: 111440400 Test: manual - An input-associated surface with a scaling matrix that has dsdx, dsdy < 1. Use "dumpsys input" to observe its touchable region. Change-Id: I495bd16acec77f913fd39dcac90404eddc71cabb --- services/surfaceflinger/Layer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'services/surfaceflinger/Layer.cpp') diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 81456dfea9..58fd86618e 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -2069,10 +2069,13 @@ InputWindowInfo Layer::fillInputInfo(const Rect& screenBounds) { info.frameBottom = screenBounds.bottom - info.surfaceInset; ui::Transform t = getTransform(); - info.windowXScale *= 1.0f / t.sx(); - info.windowYScale *= 1.0f / t.sy(); - - info.touchableRegion.scaleSelf(t.sx(), t.sy()); + const float xScale = t.sx(); + const float yScale = t.sy(); + if (xScale != 1.0f || yScale != 1.0f) { + info.windowXScale *= 1.0f / xScale; + info.windowYScale *= 1.0f / yScale; + info.touchableRegion.scaleSelf(xScale, yScale); + } info.touchableRegion = info.touchableRegion.translate( screenBounds.left, -- cgit v1.2.3-59-g8ed1b