sdm: Fix Map rect for offset in source domain

If source domain has an offset move input rect
accordingly in source domain before calculating
it's equivalent rect in dst domain

Change-Id: I52b86d3cedf6f2256017b0c4d98efa9e3f031ffc
CRs-fixed: 1085287
This commit is contained in:
Prabhanjan Kandula
2016-11-02 16:55:19 -07:00
committed by Gerrit - the friendly Code Review server
parent 249e03b34c
commit 6064cad7a0

View File

@@ -205,6 +205,10 @@ void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const Lay
return; return;
} }
int x_offset = INT(src_domain.left);
int y_offset = INT(src_domain.top);
LayerRect modified_in_rect = Reposition(in_rect, -x_offset, -y_offset);
float src_domain_width = src_domain.right - src_domain.left; float src_domain_width = src_domain.right - src_domain.left;
float src_domain_height = src_domain.bottom - src_domain.top; float src_domain_height = src_domain.bottom - src_domain.top;
float dst_domain_width = dst_domain.right - dst_domain.left; float dst_domain_width = dst_domain.right - dst_domain.left;
@@ -213,10 +217,10 @@ void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const Lay
float width_ratio = dst_domain_width / src_domain_width; float width_ratio = dst_domain_width / src_domain_width;
float height_ratio = dst_domain_height / src_domain_height; float height_ratio = dst_domain_height / src_domain_height;
out_rect->left = dst_domain.left + (width_ratio * in_rect.left); out_rect->left = dst_domain.left + (width_ratio * modified_in_rect.left);
out_rect->top = dst_domain.top + (height_ratio * in_rect.top); out_rect->top = dst_domain.top + (height_ratio * modified_in_rect.top);
out_rect->right = dst_domain.left + (width_ratio * in_rect.right); out_rect->right = dst_domain.left + (width_ratio * modified_in_rect.right);
out_rect->bottom = dst_domain.top + (height_ratio * in_rect.bottom); out_rect->bottom = dst_domain.top + (height_ratio * modified_in_rect.bottom);
} }
RectOrientation GetOrientation(const LayerRect &in_rect) { RectOrientation GetOrientation(const LayerRect &in_rect) {