Loading libs/gui/GLConsumer.cpp +10 −6 Original line number Original line Diff line number Diff line Loading @@ -901,14 +901,18 @@ Rect GLConsumer::getCurrentCrop() const { // The crop is too wide // The crop is too wide if (newWidth < currentWidth) { if (newWidth < currentWidth) { uint32_t dw = (currentWidth - newWidth) / 2; uint32_t dw = currentWidth - newWidth; outCrop.left += dw; auto halfdw = dw / 2; outCrop.right -= dw; outCrop.left += halfdw; // Not halfdw because it would subtract 1 too few when dw is odd outCrop.right -= (dw - halfdw); // The crop is too tall // The crop is too tall } else if (newHeight < currentHeight) { } else if (newHeight < currentHeight) { uint32_t dh = (currentHeight - newHeight) / 2; uint32_t dh = currentHeight - newHeight; outCrop.top += dh; auto halfdh = dh / 2; outCrop.bottom -= dh; outCrop.top += halfdh; // Not halfdh because it would subtract 1 too few when dh is odd outCrop.bottom -= (dh - halfdh); } } GLC_LOGV("getCurrentCrop final crop [%d,%d,%d,%d]", GLC_LOGV("getCurrentCrop final crop [%d,%d,%d,%d]", Loading Loading
libs/gui/GLConsumer.cpp +10 −6 Original line number Original line Diff line number Diff line Loading @@ -901,14 +901,18 @@ Rect GLConsumer::getCurrentCrop() const { // The crop is too wide // The crop is too wide if (newWidth < currentWidth) { if (newWidth < currentWidth) { uint32_t dw = (currentWidth - newWidth) / 2; uint32_t dw = currentWidth - newWidth; outCrop.left += dw; auto halfdw = dw / 2; outCrop.right -= dw; outCrop.left += halfdw; // Not halfdw because it would subtract 1 too few when dw is odd outCrop.right -= (dw - halfdw); // The crop is too tall // The crop is too tall } else if (newHeight < currentHeight) { } else if (newHeight < currentHeight) { uint32_t dh = (currentHeight - newHeight) / 2; uint32_t dh = currentHeight - newHeight; outCrop.top += dh; auto halfdh = dh / 2; outCrop.bottom -= dh; outCrop.top += halfdh; // Not halfdh because it would subtract 1 too few when dh is odd outCrop.bottom -= (dh - halfdh); } } GLC_LOGV("getCurrentCrop final crop [%d,%d,%d,%d]", GLC_LOGV("getCurrentCrop final crop [%d,%d,%d,%d]", Loading