X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fskins2%2Fparser%2Fskin_parser.cpp;h=a96771b5ac101fe117eac68b436b1b2fc3a93067;hb=31dafe28c46f1952a564958f1036de5cfe0f06ea;hp=f0937e4d9d5cd7a70eea17781020b613471928bc;hpb=2bbc88ce52cbfd9ce6a3c47d1397a21f6a972495;p=vlc diff --git a/modules/gui/skins2/parser/skin_parser.cpp b/modules/gui/skins2/parser/skin_parser.cpp index f0937e4d9d..a96771b5ac 100644 --- a/modules/gui/skins2/parser/skin_parser.cpp +++ b/modules/gui/skins2/parser/skin_parser.cpp @@ -959,33 +959,45 @@ void SkinParser::convertPosition( string position, string xOffset, int refWidth, int refHeight, int* p_x, int* p_y ) { int iPosition = getPosition( position ); - if( iPosition == POS_UNDEF ) - return; + if( iPosition != POS_UNDEF ) + { + // compute offset against the parent object size + // for backward compatibility + int i_xOffset = getDimension( xOffset, refWidth ); + int i_yOffset = getDimension( yOffset, refHeight ); + int i_xMargin = getDimension( xMargin, refWidth ); + int i_yMargin = getDimension( yMargin, refHeight ); + + // compute *p_x + if( iPosition & POS_LEFT ) + *p_x = i_xMargin; + else if( iPosition & POS_RIGHT ) + *p_x = refWidth - width - i_xMargin; + else + *p_x = ( refWidth - width ) / 2; + + // compute *p_y + if( iPosition & POS_TOP ) + *p_y = i_yMargin; + else if( iPosition & POS_BOTTOM ) + *p_y = refHeight - height - i_yMargin; + else + *p_y = ( refHeight - height ) / 2; + + // add offset + *p_x += i_xOffset; + *p_y += i_yOffset; + } + else + { + // compute offset against the current object size + int i_xOffset = getDimension( xOffset, width ); + int i_yOffset = getDimension( yOffset, height ); - int i_xOffset = getDimension( xOffset, refWidth ); - int i_yOffset = getDimension( yOffset, refHeight ); - int i_xMargin = getDimension( xMargin, refWidth ); - int i_yMargin = getDimension( yMargin, refHeight ); - - // compute *p_x - if( iPosition & POS_LEFT ) - *p_x = i_xMargin; - else if( iPosition & POS_RIGHT ) - *p_x = refWidth - width - i_xMargin; - else - *p_x = ( refWidth - width ) / 2; - - // compute *p_y - if( iPosition & POS_TOP ) - *p_y = i_yMargin; - else if( iPosition & POS_BOTTOM ) - *p_y = refHeight - height - i_yMargin; - else - *p_y = ( refHeight - height ) / 2; - - // add offset - *p_x += i_xOffset; - *p_y += i_yOffset; + // add offset + *p_x += i_xOffset; + *p_y += i_yOffset; + } }