--- ./src/vidhrdw/vector.c 2005-03-06 11:50:55.000000000 -0600 +++ ../xmame-0.94-vector/./src/vidhrdw/vector.c 2005-05-07 14:08:51.000000000 -0500 @@ -82,15 +82,14 @@ static struct mame_bitmap *vecbitmap; static int vecwidth, vecheight; +static int bwidth, bheight; static int xmin, ymin, xmax, ymax; /* clipping area */ +static int bx, by; static int vector_runs; /* vector runs per refresh */ static void (*vector_draw_aa_pixel)(int x, int y, rgb_t col, int dirty); -static void vector_draw_aa_pixel_15 (int x, int y, rgb_t col, int dirty); -static void vector_draw_aa_pixel_32 (int x, int y, rgb_t col, int dirty); - void vector_register_aux_renderer(int (*aux_renderer)(point *start, int num_points)) { vector_aux_renderer = aux_renderer; @@ -205,19 +204,17 @@ old_index = 0; vector_runs = 0; + printf("here %d\n", Machine->color_depth); switch(Machine->color_depth) { - case 15: - vector_draw_aa_pixel = vector_draw_aa_pixel_15; - break; case 32: - vector_draw_aa_pixel = vector_draw_aa_pixel_32; - break; + break; default: - logerror ("Vector games have to use direct RGB modes!\n"); + logerror ("Vector games have to use a 32-bit color mode!\n"); return 1; break; } + printf("there %d\n", Machine->color_depth); /* allocate memory for tables */ pTcosin = auto_malloc ( (2048+1) * sizeof(pTcosin[0])); /* yes! 2049 is correct */ @@ -271,61 +268,6 @@ } /* - * draws an anti-aliased pixel (blends pixel with background) - */ -#define LIMIT5(x) ((x < 0x1f)? x : 0x1f) -#define LIMIT8(x) ((x < 0xff)? x : 0xff) - -static void vector_draw_aa_pixel_15 (int x, int y, rgb_t col, int dirty) -{ - vector_pixel_t coords; - UINT32 dst; - - if (x < xmin || x >= xmax) - return; - if (y < ymin || y >= ymax) - return; - - dst = ((UINT16 *)vecbitmap->line[y])[x]; - ((UINT16 *)vecbitmap->line[y])[x] = LIMIT5((RGB_BLUE(col) >> 3) + (dst & 0x1f)) - | (LIMIT5((RGB_GREEN(col) >> 3) + ((dst >> 5) & 0x1f)) << 5) - | (LIMIT5((RGB_RED(col) >> 3) + (dst >> 10)) << 10); - - coords = VECTOR_PIXEL(x,y); - if (p_index= xmax) - return; - if (y < ymin || y >= ymax) - return; - - dst = ((UINT32 *)vecbitmap->line[y])[x]; - ((UINT32 *)vecbitmap->line[y])[x] = LIMIT8(RGB_BLUE(col) + (dst & 0xff)) - | (LIMIT8(RGB_GREEN(col) + ((dst >> 8) & 0xff)) << 8) - | (LIMIT8(RGB_RED(col) + (dst >> 16)) << 16); - - coords = VECTOR_PIXEL(x,y); - if (p_indexline[by])[bx++] = 0; + bx = 0; + by++; + } +} + +static inline void vector_draw_pixel(int x, int y, int intensity, int dirty) { + int k; + UINT32 v1 = ((x/4)<<16) | (255-((y+2)/4)); + UINT32 v2 = (((x+1)/4)<<16) | (255-((y+3)/4)); + UINT32 v3 = (((x+2)/4)<<16) | (255-(y/4)); + UINT32 v4 = (((x+3)/4)<<16) | (255-((y+1)/4)); + + // intensity = (intensity + 7) / 8; + intensity = 12 + (intensity + 15) / 16; + + if (x < xmin || x >= xmax) + return; + if (y < ymin || y >= ymax) + return; + + for(k=0; kline[by])[bx++] = v1 | (0xff << 8); + ((UINT32*)vecbitmap->line[by])[bx++] = v3 | (0xff << 8); + ((UINT32*)vecbitmap->line[by])[bx++] = v2 | (0xff << 8); + ((UINT32*)vecbitmap->line[by])[bx++] = v4 | (0xff << 8); + } else { + ((UINT32*)vecbitmap->line[by])[bx++] = v1; + ((UINT32*)vecbitmap->line[by])[bx++] = v3; + ((UINT32*)vecbitmap->line[by])[bx++] = v2; + ((UINT32*)vecbitmap->line[by])[bx++] = v4; + } + // bx++; + if(bx > bwidth) { + bx = 0; + by++; + if(by > bheight) by = 0; + } + } +} + void vector_draw_to(int x2, int y2, rgb_t col, int intensity, int dirty, rgb_t (*color_callback)(void)) { unsigned char a1; @@ -347,134 +333,50 @@ x2 = (int)(vector_scale_x*x2); y2 = (int)(vector_scale_y*y2); - /* [2] adjust cords if needed */ - - if (antialias) - { - if(beam_diameter_is_one) - { - x2 = (x2+0x8000)&0xffff0000; - y2 = (y2+0x8000)&0xffff0000; - } - } - else /* noantialiasing */ - { - x2 = (x2 + 0x8000) >> 16; - y2 = (y2 + 0x8000) >> 16; - } + x2 = (x2 + 0x8000) >> 16; + y2 = (y2 + 0x8000) >> 16; /* [3] handle color and intensity */ if (intensity == 0) goto end_draw; - col = Tinten(intensity, col); - - /* [4] draw line */ - - if (antialias) - { - /* draw an anti-aliased line */ - dx = abs(x1 - x2); - dy = abs(yy1 - y2); - - if (dx >= dy) - { - sx = ((x1 <= x2) ? 1 : -1); - sy = vec_div(y2 - yy1, dx); - if (sy < 0) - dy--; - x1 >>= 16; - xx = x2 >> 16; - width = vec_mult(beam << 4, Tcosin(abs(sy) >> 5)); - if (!beam_diameter_is_one) - yy1 -= width >> 1; /* start back half the diameter */ - for (;;) - { - if (color_callback) col = Tinten(intensity, (*color_callback)()); - dx = width; /* init diameter of beam */ - dy = yy1 >> 16; - vector_draw_aa_pixel(x1, dy++, Tinten(Tgammar[0xff & (yy1 >> 8)], col), dirty); - dx -= 0x10000 - (0xffff & yy1); /* take off amount plotted */ - a1 = Tgamma[(dx >> 8) & 0xff]; /* calc remainder pixel */ - dx >>= 16; /* adjust to pixel (solid) count */ - while (dx--) /* plot rest of pixels */ - vector_draw_aa_pixel(x1, dy++, col, dirty); - vector_draw_aa_pixel(x1, dy, Tinten(a1,col), dirty); - if (x1 == xx) break; - x1 += sx; - yy1 += sy; - } - } - else - { - sy = ((yy1 <= y2) ? 1: -1); - sx = vec_div(x2 - x1, dy); - if (sx < 0) - dx--; - yy1 >>= 16; - yy = y2 >> 16; - width = vec_mult(beam << 4,Tcosin(abs(sx) >> 5)); - if (!beam_diameter_is_one) - x1 -= width >> 1; /* start back half the width */ - for (;;) - { - if (color_callback) col = Tinten(intensity, (*color_callback)()); - dy = width; /* calc diameter of beam */ - dx = x1 >> 16; - vector_draw_aa_pixel(dx++, yy1, Tinten(Tgammar[0xff & (x1 >> 8)], col), dirty); - dy -= 0x10000 - (0xffff & x1); /* take off amount plotted */ - a1 = Tgamma[(dy >> 8) & 0xff]; /* remainder pixel */ - dy >>= 16; /* adjust to pixel (solid) count */ - while (dy--) /* plot rest of pixels */ - vector_draw_aa_pixel(dx++, yy1, col, dirty); - vector_draw_aa_pixel(dx, yy1, Tinten(a1, col), dirty); - if (yy1 == yy) break; - yy1 += sy; - x1 += sx; - } - } - } - else /* use good old Bresenham for non-antialiasing 980317 BW */ - { - dx = abs(x1 - x2); - dy = abs(yy1 - y2); - sx = (x1 <= x2) ? 1 : -1; - sy = (yy1 <= y2) ? 1 : -1; - cx = dx / 2; - cy = dy / 2; - - if (dx >= dy) - { - for (;;) - { - if (color_callback) col = Tinten(intensity, (*color_callback)()); - vector_draw_aa_pixel(x1, yy1, col, dirty); - if (x1 == x2) break; - x1 += sx; - cx -= dy; - if (cx < 0) - { - yy1 += sy; - cx += dx; - } - } - } - else - { - for (;;) - { - if (color_callback) col = Tinten(intensity, (*color_callback)()); - vector_draw_aa_pixel(x1, yy1, col, dirty); - if (yy1 == y2) break; - yy1 += sy; - cy -= dx; - if (cy < 0) - { - x1 += sx; - cy += dy; - } - } - } + /* use good old Bresenham for non-antialiasing 980317 BW */ + dx = abs(x1 - x2); + dy = abs(yy1 - y2); + sx = (x1 <= x2) ? 1 : -1; + sy = (yy1 <= y2) ? 1 : -1; + cx = dx / 2; + cy = dy / 2; + + if (dx >= dy) + { + for (;;) + { + vector_draw_pixel(x1, yy1, intensity, dirty); + if (x1 == x2) break; + x1 += sx; + cx -= dy; + if (cx < 0) + { + yy1 += sy; + cx += dx; + } + } + } + else + { + for (;;) + { + vector_draw_pixel(x1, yy1, intensity, dirty); + if (yy1 == y2) break; + yy1 += sy; + cy -= dx; + if (cy < 0) + { + x1 += sx; + cy += dy; + } + } } end_draw: @@ -736,15 +639,18 @@ /* copy parameters */ vecbitmap = bitmap; - vecwidth = bitmap->width; - vecheight = bitmap->height; - + bwidth = bitmap->width; + bheight = bitmap->height; + vecwidth = 1021; + vecheight = 1021; /* reset clipping area */ xmin = 0; xmax = vecwidth; ymin = 0; ymax = vecheight; + bx = by = 0; + /* setup scaling */ vector_scale_x = ((float)vecwidth)/(Machine->visible_area.max_x - Machine->visible_area.min_x); vector_scale_y = ((float)vecheight)/(Machine->visible_area.max_y - Machine->visible_area.min_y); @@ -758,9 +664,6 @@ dirty_index = 0; clever_mark_dirty(); - /* clear ALL pixels in the hidden map */ - vector_clear_pixels(); - /* Draw ALL lines into the hidden map. Mark only those lines with */ /* new->dirty = 1 as dirty. Remember the pixel start/end indices */ curpoint = new_list; @@ -781,5 +684,6 @@ curpoint++; } + vector_fill(); vector_dirty_list[dirty_index] = VECTOR_PIXEL_END; } --- ./src/mame.c 2005-03-12 20:36:49.000000000 -0600 +++ ../xmame-0.94-vector/./src/mame.c 2005-05-01 12:50:30.000000000 -0500 @@ -882,16 +882,10 @@ mame_debug = options.mame_debug; /* determine the color depth */ - Machine->color_depth = 16; + Machine->color_depth = 32; alpha_active = 0; if (Machine->drv->video_attributes & VIDEO_RGB_DIRECT) { - /* pick a default */ - if (Machine->drv->video_attributes & VIDEO_NEEDS_6BITS_PER_GUN) - Machine->color_depth = 32; - else - Machine->color_depth = 15; - /* enable alpha for direct video modes */ alpha_active = 1; alpha_init();