2001-10-03 14:41:53 +00:00
|
|
|
/* Stuff for correct aspect scaling. */
|
|
|
|
|
|
|
|
float monitor_aspect=4.0/3.0;
|
|
|
|
|
|
|
|
/* aspect is called with the source resolution and the
|
|
|
|
* resolution, that the scaled image should fit into
|
|
|
|
*/
|
|
|
|
|
2001-10-03 15:31:51 +00:00
|
|
|
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)
|
2001-10-03 14:41:53 +00:00
|
|
|
* ((float)fitinh/((float)fitinw/monitor_aspect)));
|
2001-10-03 15:31:51 +00:00
|
|
|
*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)
|
2001-10-03 14:41:53 +00:00
|
|
|
* ((float)fitinw/((float)fitinh/(1/monitor_aspect))));
|
2001-10-03 15:31:51 +00:00
|
|
|
*srcw+=*srcw%2; // round
|
2001-10-03 14:41:53 +00:00
|
|
|
}
|
2001-10-03 15:31:51 +00:00
|
|
|
//printf("aspect ret wh: %dx%d\n",*srcw,*srch);
|
2001-10-03 14:41:53 +00:00
|
|
|
}
|
|
|
|
|