Ver código fonte

Add -demozoom parameter to mandelbrot example, to easily select the demo zoom speed

Samuel Thibault 14 anos atrás
pai
commit
51cd5f410b
1 arquivos alterados com 8 adições e 2 exclusões
  1. 8 2
      examples/mandelbrot/mandelbrot.c

+ 8 - 2
examples/mandelbrot/mandelbrot.c

@@ -29,6 +29,7 @@ int use_x11 = 1;
 #endif
 
 int demo = 0;
+static double demozoom = 0.05;
 
 /* NB: The X11 code is inspired from the http://locklessinc.com/articles/mandelbrot/ article */
 
@@ -396,7 +397,7 @@ static void parse_args(int argc, char **argv)
 	int i;
 	for (i = 1; i < argc; i++) {
 		if (strcmp(argv[i], "-h") == 0) {
-			fprintf(stderr, "Usage: %s [-h] [ -width 800] [-height 600] [-nblocks 16] [-no-x11] [-pos leftx:rightx:bottomy:topy] [-niter 1000] [-spmd]\n", argv[0]);
+			fprintf(stderr, "Usage: %s [-h] [ -width 800] [-height 600] [-nblocks 16] [-no-x11] [-pos leftx:rightx:bottomy:topy] [-niter 1000] [-spmd] [-demo] [-demozoom 0.2]\n", argv[0]);
 			exit(-1);
 		}
 
@@ -434,6 +435,11 @@ static void parse_args(int argc, char **argv)
 
 		}
 
+		if (strcmp(argv[i], "-demozoom") == 0) {
+			char *argptr;
+			demozoom = strtof(argv[++i], &argptr);
+		}
+
 		if (strcmp(argv[i], "-no-x11") == 0) {
 #ifdef STARPU_HAVE_X11
 			use_x11 = 0;
@@ -537,7 +543,7 @@ int main(int argc, char **argv)
 		if (demo)
 		{
 			/* Zoom in */
-			double zoom_factor = 0.05;
+			double zoom_factor = demozoom;
 			double widthX = rightX - leftX;
 			double heightY = topY - bottomY;