add: screen.clip_bbox.x1 = screen.trans_x/(double)screen.scale; screen.clip_bbox.y1 = -screen.trans_y/(double)screen.scale; screen.clip_bbox.x2 = screen.gerber_bbox.x2-screen.gerber_bbox.x1; screen.clip_bbox.y2 = screen.gerber_bbox.y2-screen.gerber_bbox.y1; screen.off_x = 0; screen.off_y = 0;
context: autoscale(){    double max_width = LONG_MIN, max_height = LONG_MIN;    double x_scale, y_scale;    int i;        if (screen.drawing_area == NULL)	return;    screen.gerber_bbox.x1 = HUGE_VAL;    screen.gerber_bbox.y1 = HUGE_VAL;    screen.gerber_bbox.x2 = -HUGE_VAL;    screen.gerber_bbox.y2 = -HUGE_VAL;    for(i = 0; i < MAX_FILES; i++) {        if (screen.file[i]) {                        /*              * Find the biggest image and use as a size reference             */	    screen.gerber_bbox.x1 = MIN(screen.gerber_bbox.x1,					screen.file[i]->image->info->min_x+					screen.file[i]->image->info->offset_a);	    screen.gerber_bbox.y1 = MIN(screen.gerber_bbox.y1,					screen.file[i]->image->info->min_y+					screen.file[i]->image->info->offset_b);	    screen.gerber_bbox.x2 = MAX(screen.gerber_bbox.x2,					screen.file[i]->image->info->max_x+					screen.file[i]->image->info->offset_a);	    screen.gerber_bbox.y2 = MAX(screen.gerber_bbox.y2,					screen.file[i]->image->info->max_y+					screen.file[i]->image->info->offset_b);        }    }    max_width = screen.gerber_bbox.x2 - screen.gerber_bbox.x1;    max_height = screen.gerber_bbox.y2 - screen.gerber_bbox.y1;    /*     * Calculate scale for both x axis and y axis     */    x_scale = screen.drawing_area->allocation.width / max_width;    y_scale = screen.drawing_area->allocation.height / max_height;    /*     * Take the scale that fits both directions with some extra checks     */    screen.scale = (int)ceil(MIN(x_scale, y_scale));    if (screen.scale < 1)	screen.scale = 1;    if (screen.scale > 10)	screen.scale = (screen.scale / 10) * 10;    /*     * Calculate translation     */    if (x_scale < y_scale) {	screen.trans_x = 0;	screen.trans_y = -(int)((double)((screen.drawing_area->allocation.height-screen.scale*(max_height))/2.0));    } else {	screen.trans_x = -(int)((double)((screen.drawing_area->allocation.width-screen.scale*(max_width))/2.0));	screen.trans_y = 0;    }    return;} /* autoscale */