overlayLib: Add support for flipping the source

When the FLIP_H is passed, the overlay needs to flip the image along the vertical axis and similarly
when the FLIP_V is passed, the flip needs to happen along the horizontal axis

Change-Id: Iae31a1ca266e7e0bb9e598c88cb0728f35028052
This commit is contained in:
Naomi Luis 2011-02-07 14:00:08 -08:00 committed by Govind Surti
parent 8bd9729c72
commit c096d185f1

View File

@ -79,22 +79,18 @@ static int get_size(int format, int w, int h) {
static int get_mdp_orientation(int rotation, int flip) {
switch(flip) {
case HAL_TRANSFORM_FLIP_H:
case HAL_TRANSFORM_FLIP_V:
switch(rotation) {
case 0: return MDP_FLIP_UD;
case HAL_TRANSFORM_ROT_90: return (MDP_ROT_90 | MDP_FLIP_LR);
case HAL_TRANSFORM_ROT_180: return MDP_FLIP_LR;
case HAL_TRANSFORM_ROT_270: return (MDP_ROT_90 | MDP_FLIP_UD);
case HAL_TRANSFORM_ROT_90: return (MDP_ROT_90 | MDP_FLIP_UD);
default: return -1;
break;
}
break;
case HAL_TRANSFORM_FLIP_V:
case HAL_TRANSFORM_FLIP_H:
switch(rotation) {
case 0: return MDP_FLIP_LR;
case HAL_TRANSFORM_ROT_90: return (MDP_ROT_90 | MDP_FLIP_UD);
case HAL_TRANSFORM_ROT_180: return MDP_FLIP_UD;
case HAL_TRANSFORM_ROT_270: return (MDP_ROT_90 | MDP_FLIP_LR);
case HAL_TRANSFORM_ROT_90: return (MDP_ROT_90 | MDP_FLIP_LR);
default: return -1;
break;
}
@ -855,15 +851,11 @@ bool OverlayControlChannel::setParameter(int param, int value, bool fetch) {
int rot = value;
int flip = 0;
if(value & HAL_TRANSFORM_FLIP_SRC_H) {
flip = HAL_TRANSFORM_FLIP_H;
} else if(value & HAL_TRANSFORM_FLIP_SRC_V) {
flip = HAL_TRANSFORM_FLIP_V;
}
rot = value & HAL_TRANSFORM_ROT_MASK;
switch(rot) {
case 0:
case HAL_TRANSFORM_FLIP_H:
case HAL_TRANSFORM_FLIP_V:
{
if (val == MDP_ROT_90) {
int tmp = mOVInfo.src_rect.y;
@ -879,9 +871,13 @@ bool OverlayControlChannel::setParameter(int param, int value, bool fetch) {
mOVInfo.src_rect.y = tmp;
swapOVRotWidthHeight();
}
rot = 0;
flip = value & (HAL_TRANSFORM_FLIP_H|HAL_TRANSFORM_FLIP_V);
break;
}
case OVERLAY_TRANSFORM_ROT_90:
case HAL_TRANSFORM_ROT_90:
case (HAL_TRANSFORM_ROT_90|HAL_TRANSFORM_FLIP_H):
case (HAL_TRANSFORM_ROT_90|HAL_TRANSFORM_FLIP_V):
{
if (val == MDP_ROT_270) {
mOVInfo.src_rect.x = mOVInfo.src.width - (
@ -896,9 +892,11 @@ bool OverlayControlChannel::setParameter(int param, int value, bool fetch) {
mOVInfo.src_rect.y = tmp;
swapOVRotWidthHeight();
}
rot = HAL_TRANSFORM_ROT_90;
flip = value & (HAL_TRANSFORM_FLIP_H|HAL_TRANSFORM_FLIP_V);
break;
}
case OVERLAY_TRANSFORM_ROT_180:
case HAL_TRANSFORM_ROT_180:
{
if (val == MDP_ROT_270) {
int tmp = mOVInfo.src_rect.y;
@ -916,7 +914,7 @@ bool OverlayControlChannel::setParameter(int param, int value, bool fetch) {
}
break;
}
case OVERLAY_TRANSFORM_ROT_270:
case HAL_TRANSFORM_ROT_270:
{
if (val == MDP_ROT_90) {
mOVInfo.src_rect.y = mOVInfo.src.height -
@ -935,11 +933,11 @@ bool OverlayControlChannel::setParameter(int param, int value, bool fetch) {
}
default: return false;
}
int mdp_format = get_mdp_orientation(rot, flip);
if(mdp_format == -1)
int mdp_rotation = get_mdp_orientation(rot, flip);
if (mdp_rotation == -1)
return false;
mOVInfo.user_data[0] = mdp_format;
mOVInfo.user_data[0] = mdp_rotation;
mRotInfo.rotations = mOVInfo.user_data[0];
if (mOVInfo.user_data[0])