Mercurial > mplayer.hg
view libvo/aspect.c @ 2190:81b7d130ccab
added functions :
+ cc_check() replaces "$_cc" "$TMPC" -o "$TMPO" "$@" >/dev/null 2>&1
+ die() replaces echo "Error blah" / flush tempfiles / exit
+ boolean OS macros : linux() bsd() bsdos() freebsd() openbsd()
(note: bsd = bsdos || freebsd || openbsd)
changed handling of directories with "for" loops (tempdir && css detection)
added XXX where things need to be checked for a particular OS
removed unnecessary tempfile flush
modified a few if... which were not obvious to read for more readability
reidented the --help message for it to be more "80-char-wide-terms" aware
changed a few echo ... echo ... echo ... to cat <<EOF
enabled THREAD_SAFE's flags for BSD's and Linux (-D_REENTRANT)
author | pl |
---|---|
date | Sat, 13 Oct 2001 16:53:37 +0000 |
parents | 7f27b212e07b |
children | a98d5300f5e9 |
line wrap: on
line source
/* Stuff for correct aspect scaling. */ #undef ASPECT_DEBUG #ifdef ASPECT_DEBUG #include <stdio.h> #endif float monitor_aspect=4.0/3.0; /* aspect is called with the source resolution and the * resolution, that the scaled image should fit into */ void aspect(int *srcw, int *srch, int fitinw, int fitinh){ int srcwcp, srchcp; srcwcp=*srcw; srchcp=*srch; srcwcp=fitinw; #ifdef ASPECT_DEBUG printf("aspect(0) fitin: %dx%d \n",fitinw,fitinh); printf("aspect(1) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch); #endif srchcp=(int)(((float)fitinw / (float)*srcw * (float)*srch) * ((float)fitinh / ((float)fitinw / monitor_aspect))); srchcp+=srchcp%2; // round #ifdef ASPECT_DEBUG printf("aspect(2) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch); #endif if(srchcp>fitinh || srchcp<*srch){ srchcp=fitinh; srcwcp=(int)(((float)fitinh / (float)*srch * (float)*srcw) * ((float)fitinw / ((float)fitinh / (1/monitor_aspect)))); srcwcp+=srcwcp%2; // round } #ifdef ASPECT_DEBUG printf("aspect(3) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch); #endif *srcw=srcwcp; *srch=srchcp; #ifdef ASPECT_DEBUG printf("aspect(4) wh: %dx%d (org: %dx%d)\n",srcwcp,srchcp,*srcw,*srch); #endif }