Changeset - r7432:2169a3ae7f12
[Not reviewed]
master
0 2 0
truelight - 17 years ago 2007-08-10 13:11:53
truelight@openttd.org
(svn r10837) -Fix [FS#1102]: DrawLine didn't bound-check the first pixel that was drawn (frosch)
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/blitter/32bpp_base.cpp
Show inline comments
 
@@ -47,25 +47,25 @@ void Blitter_32bppBase::DrawLine(void *v
 
	} else {
 
		stepy = 1;
 
	}
 

	
 
	dx = (x2 - x) * 2;
 
	if (dx < 0) {
 
		dx = -dx;
 
		stepx = -1;
 
	} else {
 
		stepx = 1;
 
	}
 

	
 
	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) {
 
		frac = dy - (dx / 2);
 
		while (x != x2) {
 
			if (frac >= 0) {
 
				y += stepy;
 
				frac -= dx;
 
			}
 
			x += stepx;
 
			frac += dy;
 
			if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
 
		}
 
	} else {
src/blitter/8bpp_base.cpp
Show inline comments
 
@@ -51,25 +51,25 @@ void Blitter_8bppBase::DrawLine(void *vi
 
	} else {
 
		stepy = 1;
 
	}
 

	
 
	dx = (x2 - x) * 2;
 
	if (dx < 0) {
 
		dx = -dx;
 
		stepx = -1;
 
	} else {
 
		stepx = 1;
 
	}
 

	
 
	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) {
 
		frac = dy - (dx / 2);
 
		while (x != x2) {
 
			if (frac >= 0) {
 
				y += stepy;
 
				frac -= dx;
 
			}
 
			x += stepx;
 
			frac += dy;
 
			if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
 
		}
 
	} else {
0 comments (0 inline, 0 general)