version 1.2 | | version 1.3 |
---|
| | |
* Graphical routines for manipulating grs_canvas's. | | * Graphical routines for manipulating grs_canvas's. |
* | | * |
* $Log$ | | * $Log$ |
| | * Revision 1.3 2006/04/14 05:19:10 donut |
| | * Add -aspect argument to force aspect ratio, make better guess about aspect when not specified |
| | * |
* Revision 1.2 1999/08/05 22:53:40 sekmu | | * Revision 1.2 1999/08/05 22:53:40 sekmu |
* | | * |
* D3D patch(es) from ADB | | * D3D patch(es) from ADB |
| | |
#include <stdlib.h> | | #include <stdlib.h> |
//#include <malloc.h> | | //#include <malloc.h> |
#include <stdio.h> | | #include <stdio.h> |
| | #include <string.h> |
| | |
#include "u_mem.h" | | #include "u_mem.h" |
| | |
| | |
| | #include "args.h" |
#include "gr.h" | | #include "gr.h" |
#include "grdef.h" | | #include "grdef.h" |
#ifdef __MSDOS__ | | #ifdef __MSDOS__ |
| | |
#endif | | #endif |
} | | } |
| | |
| | fix gr_calc_aspect(unsigned int w, unsigned int h) { |
| | int t; |
| | //first check for manually specified aspect ratio |
| | if ((t=FindArg("-aspect"))) { |
| | char *u = Args[t+1]; |
| | char *v = strchr(u,':'); |
| | if (v) { |
| | return fixdiv(w*atoi(v+1), h*atoi(u)); |
| | } else { |
| | printf("Invalid aspect: \"%s\". Expected \"<w>:<h>\".\n", u); |
| | } |
| | } |
| | if ((w==320 && (h==100 || h==200 || h==400)) || (w==640 && h==400)) |
| | return fixdiv(w*3,h*4); //special case "standard" funky resolutions |
| | else |
| | return f1_0; //otherwise, assume square pixels |
| | } |
| | |