From 1ced496e34e8c897eddb7b1f6198dce4bdef198b Mon Sep 17 00:00:00 2001 From: Gustavo Diaz Prado Date: Fri, 21 Sep 2012 18:05:11 -0500 Subject: hwc: rgz: Fix incorrect src rectangle calculation for scaled layers When scaling a layer, the blit is programmed in a way where the src rectangle uses the whole cropping rectangle coordinates and dimensions. However if the layer has a transform, the width and the height need to be swapped not only in the geometry but also in the src rectangle to match the new dimensions. This patch adds the missing width and height swapping for the src rectangle if the transformation is 90 or 270 degrees. Change-Id: Ia9d822b6698210573fff662f2fcb129dfc048bf7 Signed-off-by: Gustavo Diaz Prado --- hwc/rgz_2d.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'hwc') diff --git a/hwc/rgz_2d.c b/hwc/rgz_2d.c index 60cc8a6..5c4d1a9 100644 --- a/hwc/rgz_2d.c +++ b/hwc/rgz_2d.c @@ -1231,13 +1231,16 @@ static void rgz_get_src_rect(hwc_layer_t* layer, blit_rect_t *subregion_rect, bl * If the layer is scaled we use the whole cropping rectangle from the * source and just move the clipping rectangle for the region we want to * blit, this is done to prevent any artifacts when blitting subregions of - * a scaled layer + * a scaled layer. If there is a transform, adjust the width and height + * accordingly to match the rotated buffer geometry. */ if (rgz_hwc_scaled(layer)) { delta_top = 0; delta_left = 0; res_width = WIDTH(layer->sourceCrop); res_height = HEIGHT(layer->sourceCrop); + if (layer->transform & HAL_TRANSFORM_ROT_90) + swap(res_width , res_height); } else { delta_top = subregion_rect->top - layer->displayFrame.top; delta_left = subregion_rect->left - layer->displayFrame.left; -- cgit v1.1