From 370a4b1416bd799afc998cce92e80b5e015ff5c2 Mon Sep 17 00:00:00 2001 From: Saurabh Shah Date: Fri, 13 Jun 2014 11:41:13 -0700 Subject: [PATCH] hwc: On downscale check swap on 90 transform While checking for valid dimensions, take 90 transform into account while calculating downscales. b/14225977 Change-Id: Ie8b527c8263a5eb366ae2a4adaa2ffbbf270ba50 --- msm8226/libhwcomposer/hwc_mdpcomp.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/msm8226/libhwcomposer/hwc_mdpcomp.cpp b/msm8226/libhwcomposer/hwc_mdpcomp.cpp index a6609f9d5f..b08f99be1b 100644 --- a/msm8226/libhwcomposer/hwc_mdpcomp.cpp +++ b/msm8226/libhwcomposer/hwc_mdpcomp.cpp @@ -348,8 +348,9 @@ bool MDPComp::isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer) { hwc_rect_t crop = integerizeSourceCrop(layer->sourceCropf); hwc_rect_t dst = layer->displayFrame; - int crop_w = crop.right - crop.left; - int crop_h = crop.bottom - crop.top; + bool rotated90 = (bool)layer->transform & HAL_TRANSFORM_ROT_90; + int crop_w = rotated90 ? crop.bottom - crop.top : crop.right - crop.left; + int crop_h = rotated90 ? crop.right - crop.left : crop.bottom - crop.top; int dst_w = dst.right - dst.left; int dst_h = dst.bottom - dst.top; float w_scale = ((float)crop_w / (float)dst_w);