sdm: Add support to recompute rectangles considering flips
CRs-Fixed: 2006534 Change-Id: I698e9cd6eddf958fa564e4d32fa5b98057eb9f1d
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
13321553e5
commit
5de9c63778
@@ -57,7 +57,8 @@ namespace sdm {
|
|||||||
bool flip_horizontal, LayerRect *out_rects);
|
bool flip_horizontal, LayerRect *out_rects);
|
||||||
void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
|
void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
|
||||||
LayerRect *out_rect);
|
LayerRect *out_rect);
|
||||||
void TransformHV(const LayerRect &src_domain, const LayerRect &in_rect, LayerRect *out_rect);
|
void TransformHV(const LayerRect &src_domain, const LayerRect &in_rect,
|
||||||
|
const LayerTransform &transform, LayerRect *out_rect);
|
||||||
RectOrientation GetOrientation(const LayerRect &in_rect);
|
RectOrientation GetOrientation(const LayerRect &in_rect);
|
||||||
} // namespace sdm
|
} // namespace sdm
|
||||||
|
|
||||||
|
|||||||
@@ -91,16 +91,19 @@ DisplayError DisplayPrimary::Prepare(LayerStack *layer_stack) {
|
|||||||
bool needs_hv_flip = hw_panel_info_.panel_orientation.flip_horizontal &&
|
bool needs_hv_flip = hw_panel_info_.panel_orientation.flip_horizontal &&
|
||||||
hw_panel_info_.panel_orientation.flip_vertical;
|
hw_panel_info_.panel_orientation.flip_vertical;
|
||||||
LayerRect src_domain = {};
|
LayerRect src_domain = {};
|
||||||
|
LayerTransform panel_transform = {};
|
||||||
DisplayConfigVariableInfo variable_info = {};
|
DisplayConfigVariableInfo variable_info = {};
|
||||||
|
|
||||||
if (needs_hv_flip) {
|
if (needs_hv_flip) {
|
||||||
DisplayBase::GetFrameBufferConfig(&variable_info);
|
DisplayBase::GetFrameBufferConfig(&variable_info);
|
||||||
src_domain.right = variable_info.x_pixels;
|
src_domain.right = variable_info.x_pixels;
|
||||||
src_domain.bottom = variable_info.y_pixels;
|
src_domain.bottom = variable_info.y_pixels;
|
||||||
|
panel_transform.flip_horizontal = hw_panel_info_.panel_orientation.flip_horizontal;
|
||||||
|
panel_transform.flip_vertical = hw_panel_info_.panel_orientation.flip_vertical;
|
||||||
|
|
||||||
for (Layer *layer : layer_stack->layers) {
|
for (Layer *layer : layer_stack->layers) {
|
||||||
// Modify destination based on panel flip
|
// Modify destination based on panel flip
|
||||||
TransformHV(src_domain, layer->dst_rect, &layer->dst_rect);
|
TransformHV(src_domain, layer->dst_rect, panel_transform, &layer->dst_rect);
|
||||||
|
|
||||||
if (layer->flags.solid_fill) {
|
if (layer->flags.solid_fill) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -223,18 +223,27 @@ void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const Lay
|
|||||||
out_rect->bottom = dst_domain.top + (height_ratio * modified_in_rect.bottom);
|
out_rect->bottom = dst_domain.top + (height_ratio * modified_in_rect.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransformHV(const LayerRect &src_domain, const LayerRect &in_rect, LayerRect *out_rect) {
|
void TransformHV(const LayerRect &src_domain, const LayerRect &in_rect,
|
||||||
|
const LayerTransform &transform, LayerRect *out_rect) {
|
||||||
if (!IsValid(src_domain) || !IsValid(in_rect)) {
|
if (!IsValid(src_domain) || !IsValid(in_rect)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float in_width = in_rect.right - in_rect.left;
|
float in_width = in_rect.right - in_rect.left;
|
||||||
float in_height = in_rect.bottom - in_rect.top;
|
float in_height = in_rect.bottom - in_rect.top;
|
||||||
|
float x_offset = in_rect.left - src_domain.left;
|
||||||
|
float y_offset = in_rect.top - src_domain.top;
|
||||||
|
*out_rect = in_rect;
|
||||||
|
|
||||||
out_rect->right = src_domain.right - in_rect.left;
|
if (transform.flip_horizontal) {
|
||||||
out_rect->bottom = src_domain.bottom - in_rect.top;
|
out_rect->right = src_domain.right - x_offset;
|
||||||
out_rect->left = out_rect->right - in_width;
|
out_rect->left = out_rect->right - in_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transform.flip_vertical) {
|
||||||
|
out_rect->bottom = src_domain.bottom - y_offset;
|
||||||
out_rect->top = out_rect->bottom - in_height;
|
out_rect->top = out_rect->bottom - in_height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RectOrientation GetOrientation(const LayerRect &in_rect) {
|
RectOrientation GetOrientation(const LayerRect &in_rect) {
|
||||||
|
|||||||
Reference in New Issue
Block a user