[Mplayer-cvslog] CVS: main/libvo aspect.c,NONE,1.1 aspect.h,NONE,1.1

Atmosfear atmos4 at mplayer.dev.hu
Wed Oct 3 16:41:56 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv1304/libvo

Added Files:
	aspect.c aspect.h 
Log Message:
Monitor aspect stuff.


--- NEW FILE ---
/* Stuff for correct aspect scaling. */
#include "aspect.h"

float monitor_aspect=4.0/3.0;

/* aspect is called with the source resolution and the
 * resolution, that the scaled image should fit into
 */

rect_t aspect(int srcw, int srch, int fitinw, int fitinh){
  rect_t r,z;
  r.w=fitinw;
  r.x=0;
  r.h=(int)(((float)fitinw / (float)srcw * (float)srch)
            * ((float)fitinh/((float)fitinw/monitor_aspect)));
  r.h+=r.h%2; // round
  r.y=(fitinh-r.h)/2;
  z=r;
  //printf("aspect rez x: %d y: %d  wh: %dx%d\n",r.x,r.y,r.w,r.h);
  if(r.h>fitinh || r.h<srch){
    r.h=fitinh;
    r.y=0;
    r.w=(int)(((float)fitinh / (float)srch * (float)srcw)
              * ((float)fitinw/((float)fitinh/(1/monitor_aspect))));
    r.w+=r.w%2; // round
    r.x=(fitinw-r.w)/2;
  }
  if(r.w>fitinw) r=z;
  //printf("aspect ret x: %d y: %d  wh: %dx%d\n",r.x,r.y,r.w,r.h);
  return r;
}


--- NEW FILE ---
#ifndef __ASPECT_H
#define __ASPECT_H
/* Stuff for correct aspect scaling. */

typedef struct {
  int x; /* x,y starting coordinate */
  int y; /* of upper left corner    */
  int w; /* width  */
  int h; /* height */
} rect_t;

rect_t aspect(int srcw, int srch, int fitinw, int fitinh);

#endif





More information about the MPlayer-cvslog mailing list