summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-03-04 14:58:02 -0800
committerDan Stoza <stoza@google.com>2015-03-18 16:00:44 -0700
commit2632350ac88cdf007c62e18345b71411755ed6ba (patch)
tree34d498264d342c8bbfdb23f8315640cc8f5e91ae /libs
parentc168b8a5a9dcc0e45e32fc3cd40b9410e0288fb1 (diff)
downloadframeworks_native-2632350ac88cdf007c62e18345b71411755ed6ba.zip
frameworks_native-2632350ac88cdf007c62e18345b71411755ed6ba.tar.gz
frameworks_native-2632350ac88cdf007c62e18345b71411755ed6ba.tar.bz2
GLConsumer: Fix unsigned subtraction during crop
Since some variables had been switched from signed to unsigned, there was a section of code that was guaranteed to be incorrect because it effectively did 'if (a < b) { c = a - b; }'. This change fixes it. Cherry pick of I9cdd6c9a0179801addebb5d6dc1fbaddf8f53c62 Bug: 19346631 Change-Id: Id13a46f74c9ae7278463ce22b586f4dc21b5e453
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/GLConsumer.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp
index 065345c..a0f68b4 100644
--- a/libs/gui/GLConsumer.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -899,14 +899,14 @@ Rect GLConsumer::getCurrentCrop() const {
// The crop is too wide
if (newWidth < currentWidth) {
- uint32_t dw = (newWidth - currentWidth) / 2;
- outCrop.left -=dw;
- outCrop.right += dw;
+ uint32_t dw = (currentWidth - newWidth) / 2;
+ outCrop.left += dw;
+ outCrop.right -= dw;
// The crop is too tall
} else if (newHeight < currentHeight) {
- uint32_t dh = (newHeight - currentHeight) / 2;
- outCrop.top -= dh;
- outCrop.bottom += dh;
+ uint32_t dh = (currentHeight - newHeight) / 2;
+ outCrop.top += dh;
+ outCrop.bottom -= dh;
}
GLC_LOGV("getCurrentCrop final crop [%d,%d,%d,%d]",