sdm: Add rect mapping and interface to store actual resolution

1. Add rectangle mapping function to map a rectangle from one
   coordinate system to another coordinate system.
2. Add unaligned_width and unaligned_height in layer buffer to store
   the actual buffer resolution without alignment.
3. Populate unaligned width and height information of SDM layer
   buffer from private handle

Change-Id: Ic4c03cc5779418959732332d26b8ecb59c2483b5
CRs-Fixed: 1040942
diff --git a/sdm/libs/utils/rect.cpp b/sdm/libs/utils/rect.cpp
index 3213b62..e1180e3 100644
--- a/sdm/libs/utils/rect.cpp
+++ b/sdm/libs/utils/rect.cpp
@@ -199,8 +199,8 @@
   }
 }
 
-void ScaleRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
-               LayerRect *out_rect) {
+void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
+             LayerRect *out_rect) {
   if (!IsValid(src_domain) || !IsValid(dst_domain) || !IsValid(in_rect)) {
     return;
   }
@@ -213,10 +213,10 @@
   float width_ratio = dst_domain_width / src_domain_width;
   float height_ratio = dst_domain_height / src_domain_height;
 
-  out_rect->left = width_ratio * in_rect.left;
-  out_rect->top = height_ratio * in_rect.top;
-  out_rect->right = width_ratio * in_rect.right;
-  out_rect->bottom = height_ratio * in_rect.bottom;
+  out_rect->left = dst_domain.left + (width_ratio * in_rect.left);
+  out_rect->top = dst_domain.top + (height_ratio * in_rect.top);
+  out_rect->right = dst_domain.left + (width_ratio * in_rect.right);
+  out_rect->bottom = dst_domain.top + (height_ratio * in_rect.bottom);
 }
 
 RectOrientation GetOrientation(const LayerRect &in_rect) {