+ alloc_size = sizeof(cell) * arr_width * arr_height;
+ oalloc = alloc_size;
+
+ if (mem_throttle > 0)
+ while (cell_size < windowWidth/10 &&
+ cell_size < windowHeight/10 &&
+ alloc_size > mem_throttle)
+ {
+ cell_size++;
+ arr_width = windowWidth / cell_size;
+ arr_height = windowHeight / cell_size;
+ alloc_size = sizeof(cell) * arr_width * arr_height;
+ }
+
+ if (osize != cell_size)
+ {
+ static int warned = 0;
+ if (!warned)
+ {
+ fprintf (stderr,
+ "%s: throttling cell size from %d to %d because of %dM limit.\n",
+ progname, osize, cell_size, mem_throttle / (1 << 20));
+ fprintf (stderr, "%s: %dx%dx%d = %.1fM, %dx%dx%d = %.1fM.\n",
+ progname,
+ windowWidth, windowHeight, osize,
+ ((float) oalloc) / (1 << 20),
+ windowWidth, windowHeight, cell_size,
+ ((float) alloc_size) / (1 << 20));
+ warned = 1;
+ }
+ }
+