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. Bug: 19346631 Change-Id: I9cdd6c9a0179801addebb5d6dc1fbaddf8f53c62
This commit is contained in:
parent
123edd9f81
commit
abf952c1b1
@ -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]",
|
||||
|
Loading…
Reference in New Issue
Block a user