Previous 199869 Revisions Next

r32590 Thursday 9th October, 2014 at 02:32:51 UTC by Barry Rodewald
trident: reworked Bresenham line drawing.  It's better, but I'm still not convinced it's completely accurate.
[src/emu/bus/isa]trident.c

trunk/src/emu/bus/isa/trident.c
r32589r32590
14871487//    TGUI_SRC_XY(dmin-dmaj,dmin);
14881488//    TGUI_DEST_XY(x,y);
14891489//    TGUI_DIM_XY(dmin+e,len);
1490   INT16 dx = abs(tri.accel_source_x - tri.accel_source_y);
1491   INT16 dy = abs(tri.accel_source_y);
1492   INT16 err = (tri.accel_dim_x - tri.accel_source_y);
1490   INT16 dx = tri.accel_source_y - tri.accel_source_x;
1491   INT16 dy = tri.accel_source_y;
1492   INT16 err = tri.accel_dim_x + tri.accel_source_y;
14931493   int sx = (tri.accel_drawflags & 0x0200) ? -1 : 1;
14941494   int sy = (tri.accel_drawflags & 0x0100) ? -1 : 1;
1495   int count = 0;
1496   INT16 temp;
1495   int x,y,z;
14971496
1498   if(tri.accel_drawflags & 0x0400)
1497   x = tri.accel_dest_x;
1498   y = tri.accel_dest_y;
1499
1500   WRITEPIXEL(x,y,col);
1501   for(z=0;z<tri.accel_dim_y;z++)
14991502   {
1500      temp = dx; dx = dy; dy = temp;
1501   }
1502   for(;;)
1503   {
1504      WRITEPIXEL(tri.accel_dest_x,tri.accel_dest_y,col);
1505      if (count > tri.accel_dim_y) break;
1506      count++;
1507      if((err*2) > -dy)
1503      if(tri.accel_drawflags & 0x0400)
1504         y += sy;
1505      else
1506         x += sx;
1507      if(err > 0)
15081508      {
1509         err -= dy;
1510         tri.accel_dest_x += sx;
1509         if(tri.accel_drawflags & 0x0400)
1510            x += sx;
1511         else
1512            y += sy;
1513         WRITEPIXEL(x,y,col);
1514         err += (dy-dx);
15111515      }
1512      if((err*2) < dx)
1516      else
15131517      {
1514         err += dx;
1515         tri.accel_dest_y += sy;
1518         WRITEPIXEL(x,y,col);
1519         err += dy;
15161520      }
15171521   }
15181522}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team