summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceComposerClient.cpp
diff options
context:
space:
mode:
author chaviw <chaviw@google.com> 2019-09-23 10:15:51 -0700
committer chaviw <chaviw@google.com> 2019-09-30 16:47:04 -0700
commit76f5f2fd479a700636e80b73a5357aa4f4f474a6 (patch)
tree784a97770c509ba7f1e4125b3c1850ba1ecbab38 /libs/gui/SurfaceComposerClient.cpp
parente2930c4a3f87e37699c7d0c0232d30ea324978f0 (diff)
Fix the position set for setGeometry calculation.
The current implementation of setGeometry will set the position as the x and y value of destination. However, this value will not work if the source is not at 0, 0 since it will start crop at a non zero position. The position will be set based on the non cropped area so the final content frame will not be positioned at the specified position. This change calculates the offset for x and y based on the source's crop's position and scale since it will need to create a negative offset to compensate for the crop Test: SetGeometryTest Fixes: 141495784 Change-Id: I7dc0e5f9e65f9838ebd86f304bc1ca0beffc4393
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r--libs/gui/SurfaceComposerClient.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 6b5021d1b4..547e5f1be2 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -1327,7 +1327,9 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setGeome
break;
}
setMatrix(sc, matrix[0], matrix[1], matrix[2], matrix[3]);
- setPosition(sc, x, y);
+ float offsetX = xScale * source.left;
+ float offsetY = yScale * source.top;
+ setPosition(sc, x - offsetX, y - offsetY);
return *this;
}