diff options
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) { |