mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r11169) -Fix [FS#1255]: obiwan in Blitter::Drawline(), which caused it to clip too much at screen/viewport borders. Patch by frosch.
This commit is contained in:
parent
ca7cab0253
commit
2239809bdc
@ -56,7 +56,7 @@ void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int
|
|||||||
stepx = 1;
|
stepx = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
||||||
if (dx > dy) {
|
if (dx > dy) {
|
||||||
frac = dy - (dx / 2);
|
frac = dy - (dx / 2);
|
||||||
while (x != x2) {
|
while (x != x2) {
|
||||||
@ -66,7 +66,7 @@ void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int
|
|||||||
}
|
}
|
||||||
x += stepx;
|
x += stepx;
|
||||||
frac += dy;
|
frac += dy;
|
||||||
if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
frac = dx - (dy / 2);
|
frac = dx - (dy / 2);
|
||||||
@ -77,7 +77,7 @@ void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int
|
|||||||
}
|
}
|
||||||
y += stepy;
|
y += stepy;
|
||||||
frac += dx;
|
frac += dx;
|
||||||
if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int s
|
|||||||
stepx = 1;
|
stepx = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
||||||
if (dx > dy) {
|
if (dx > dy) {
|
||||||
frac = dy - (dx / 2);
|
frac = dy - (dx / 2);
|
||||||
while (x != x2) {
|
while (x != x2) {
|
||||||
@ -70,7 +70,7 @@ void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int s
|
|||||||
}
|
}
|
||||||
x += stepx;
|
x += stepx;
|
||||||
frac += dy;
|
frac += dy;
|
||||||
if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
frac = dx - (dy / 2);
|
frac = dx - (dy / 2);
|
||||||
@ -81,7 +81,7 @@ void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int s
|
|||||||
}
|
}
|
||||||
y += stepy;
|
y += stepy;
|
||||||
frac += dx;
|
frac += dx;
|
||||||
if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user