From 16b7f6c4b06ac7350c30309d0559a466097d8ae7 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Mon, 7 May 2012 16:42:31 -0500 Subject: hwc: Fix truncation errors in scaling decision When checking if we are downscaling beyond what the hardware supports, we were dividing by the factors rather than multiplying the other side with them. The truncation of the divisions had hwc allowing downscaling by a factor slightly larger than what was supported. Change-Id: I6ae4d897f4afe68ae26f0d7385e4003d6f2a4253 Signed-off-by: Lajos Molnar --- hwc/hwc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hwc/hwc.c b/hwc/hwc.c index b5b80ec..d6c28f7 100644 --- a/hwc/hwc.c +++ b/hwc/hwc.c @@ -46,6 +46,8 @@ #define WIDTH(rect) ((rect).right - (rect).left) #define HEIGHT(rect) ((rect).bottom - (rect).top) +#define DIV_ROUND_UP(a, b) (((a) + (b) - 1) / (b)) + #include