12 #include "../stdafx.h" 
   14 #include "../core/math_func.hpp" 
   16 #include "../safeguards.h" 
   18 void Blitter::DrawLine(
void *video, 
int x, 
int y, 
int x2, 
int y2, 
int screen_width, 
int screen_height, uint8 colour, 
int width, 
int dash)
 
   41   if (dx == 0 && dy == 0) {
 
   43     if (x >= 0 && x < screen_width && y >= 0 && y < screen_height) this->
SetPixel(video, x, y, colour);
 
   47   int frac_diff = width * 
max(dx, dy);
 
   52     int frac_sq = width * width * (dx * dx + dy * dy);
 
   53     int frac_max = 3 * frac_diff / 2;
 
   54     while (frac_diff < frac_max) {
 
   55       int frac_test = (frac_diff + frac_max) / 2;
 
   56       if (frac_test * frac_test < frac_sq) {
 
   57         frac_diff = frac_test + 1;
 
   59         frac_max = frac_test - 1;
 
   65   if (dash == 0) dash = 1;
 
   70     int frac_low  = dy - frac_diff / 2;
 
   71     int frac_high = dy + frac_diff / 2;
 
   73     while (frac_low + dx / 2 < 0) {
 
   77     while (frac_high - dx / 2 >= 0) {
 
   84       if (dash_count < dash && x >= 0 && x < screen_width) {
 
   85         for (
int y = y_low; y != y_high; y += stepy) {
 
   86           if (y >= 0 && y < screen_height) this->
SetPixel(video, x, y, colour);
 
  100       if (++dash_count >= dash + gap) dash_count = 0;
 
  105     int frac_low  = dx - frac_diff / 2;
 
  106     int frac_high = dx + frac_diff / 2;
 
  108     while (frac_low + dy / 2 < 0) {
 
  112     while (frac_high - dy / 2 >= 0) {
 
  119       if (dash_count < dash && y >= 0 && y < screen_height) {
 
  120         for (
int x = x_low; x != x_high; x += stepx) {
 
  121           if (x >= 0 && x < screen_width) this->
SetPixel(video, x, y, colour);
 
  128       if (frac_high >= 0) {
 
  135       if (++dash_count >= dash + gap) dash_count = 0;