diff options
| author | 2019-04-29 19:51:54 +0000 | |
|---|---|---|
| committer | 2019-04-29 19:51:54 +0000 | |
| commit | 8b30c364ebff1b467c288b5fd3451401b6cc12d1 (patch) | |
| tree | eb6c6388d481a0cbb54794d1cfde02d39b4c2a91 /libs/gui/SurfaceComposerClient.cpp | |
| parent | bb7f8aa0731a9954c8c1809ecab7e744d3c60cf5 (diff) | |
| parent | 66365e40f39e081672e50f5cbab83316b2246481 (diff) | |
Merge "Transaction::setGeometry: Handle invalid src rect correctly" into qt-dev
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
| -rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 2083a2b023..437cdd7b13 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1149,8 +1149,12 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setGeome int x = dst.left; int y = dst.top; - float xScale = dst.getWidth() / static_cast<float>(source.getWidth()); - float yScale = dst.getHeight() / static_cast<float>(source.getHeight()); + + float sourceWidth = source.getWidth(); + float sourceHeight = source.getHeight(); + + float xScale = sourceWidth < 0 ? 1.0f : dst.getWidth() / sourceWidth; + float yScale = sourceHeight < 0 ? 1.0f : dst.getHeight() / sourceHeight; float matrix[4] = {1, 0, 0, 1}; switch (transform) { |