sdm: Add split rectangle support for split rotation.

1. Add support to split rectangle vertically and horizontally.
2. Add debug property to enable/disable split rotation.

Change-Id: I4070e7e754c2a3a3a9ca4f4eab91037f7f9c88b7
This commit is contained in:
Ramkumar Radhakrishnan
2015-05-28 19:02:05 -07:00
committed by Gerrit - the friendly Code Review server
parent d5eab0c7b3
commit 345081196a
4 changed files with 50 additions and 0 deletions

View File

@@ -138,5 +138,43 @@ LayerRect Union(const LayerRect &rect1, const LayerRect &rect2) {
return res;
}
void SplitLeftRight(const LayerRect &in_rect, uint32_t split_count, uint32_t align_x,
LayerRect *out_rects) {
LayerRect rect_temp = in_rect;
uint32_t split_width = UINT32(rect_temp.right - rect_temp.left) / split_count;
for (uint32_t count = 0; count < split_count; count++) {
float aligned_right = rect_temp.left + FLOAT(CeilToMultipleOf(split_width, align_x));
out_rects[count].left = rect_temp.left;
out_rects[count].right = MIN(rect_temp.right, aligned_right);
out_rects[count].top = rect_temp.top;
out_rects[count].bottom = rect_temp.bottom;
rect_temp.left = out_rects[count].right;
Log(kTagRotator, "SplitLeftRight", out_rects[count]);
}
}
void SplitTopBottom(const LayerRect &in_rect, uint32_t split_count, uint32_t align_y,
LayerRect *out_rects) {
LayerRect rect_temp = in_rect;
uint32_t split_height = UINT32(rect_temp.bottom - rect_temp.top) / split_count;
for (uint32_t count = 0; count < split_count; count++) {
float aligned_bottom = rect_temp.top + FLOAT(CeilToMultipleOf(split_height, align_y));
out_rects[count].top = rect_temp.top;
out_rects[count].bottom = MIN(rect_temp.bottom, aligned_bottom);
out_rects[count].left = rect_temp.left;
out_rects[count].right = rect_temp.right;
rect_temp.top = out_rects[count].bottom;
Log(kTagRotator, "SplitTopBottom", out_rects[count]);
}
}
} // namespace sdm