static int vmlist_size, cur_vm = -1;
static void *backbuf;
+static int opt_width, opt_height;
static int opt_bpp = 16;
static const char *opt_fname;
init_mouse();
- modeidx = find_best_mode(img.width, img.height);
+ if(!opt_width) {
+ opt_width = img.width;
+ opt_height = img.height;
+ }
+ modeidx = find_best_mode(opt_width, opt_height);
if(switch_mode(modeidx) == -1) {
goto end;
}
int i;
static const char *usage_fmt = "Usage: %s [options] <image file>\n"
"Options:\n"
+ " -s <WxH>: choose screen resolution if available\n"
" -bpp <n>: video mode color depth (8, 15, 16, 24, 32)\n"
" -h,-help: print usage information and exit\n";
for(i=1; i<argc; i++) {
if(argv[i][0] == '-') {
- if(strcmp(argv[i], "-bpp") == 0) {
+ if(strcmp(argv[i], "-s") == 0) {
+ if(!argv[++i] || sscanf(argv[i], "%dx%d", &opt_width, &opt_height) != 2 ||
+ opt_width <= 0 || opt_height <= 0) {
+ fprintf(stderr, "invalid resolution\n");
+ return -1;
+ }
+ } else if(strcmp(argv[i], "-bpp") == 0) {
if(!argv[++i] || (opt_bpp = atoi(argv[i])) <= 0) {
fprintf(stderr, "invalid -bpp\n");
return -1;