mirror of
https://github.com/mpv-player/mpv
synced 2024-12-29 10:32:15 +00:00
Fix case where srch, srcw and fitinw and fitinh are really the same variables.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2059 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
ee2e0f2bdd
commit
dfc9e5e7d3
@ -9,17 +9,18 @@ float monitor_aspect=4.0/3.0;
|
||||
void aspect(int *srcw, int *srch, int fitinw, int fitinh){
|
||||
int srcwcp, srchcp;
|
||||
srcwcp=*srcw; srchcp=*srch;
|
||||
*srcw=fitinw;
|
||||
*srch=(int)(((float)fitinw / (float)srcwcp * (float)srchcp)
|
||||
srcwcp=fitinw;
|
||||
srchcp=(int)(((float)fitinw / (float)*srcw * (float)*srch)
|
||||
* ((float)fitinh/((float)fitinw/monitor_aspect)));
|
||||
*srch+=*srch%2; // round
|
||||
//printf("aspect rez wh: %dx%d\n",*srcw,*srch);
|
||||
if(*srch>fitinh || *srch<srchcp){
|
||||
*srch=fitinh;
|
||||
*srcw=(int)(((float)fitinh / (float)srchcp * (float)srcwcp)
|
||||
srchcp+=srchcp%2; // round
|
||||
//printf("aspect rez wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
|
||||
if(srchcp>fitinh || srchcp<*srch){
|
||||
srchcp=fitinh;
|
||||
srcwcp=(int)(((float)fitinh / (float)*srch * (float)*srcw)
|
||||
* ((float)fitinw/((float)fitinh/(1/monitor_aspect))));
|
||||
*srcw+=*srcw%2; // round
|
||||
srcwcp+=srcwcp%2; // round
|
||||
}
|
||||
//printf("aspect ret wh: %dx%d\n",*srcw,*srch);
|
||||
//printf("aspect ret wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch);
|
||||
*srcw=srcwcp; *srch=srchcp;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user