diff options
| author | Johannes Schickel | 2007-11-06 22:40:29 +0000 | 
|---|---|---|
| committer | Johannes Schickel | 2007-11-06 22:40:29 +0000 | 
| commit | 3592690b7865bfc0b86dae0841ff5fbae972b685 (patch) | |
| tree | 27a0849add919c4a5c69f4f6890e0099e0a238da /graphics/surface.cpp | |
| parent | 377ed4b1b4fc4817eb23c0ae31768b37ca3455d2 (diff) | |
| download | scummvm-rg350-3592690b7865bfc0b86dae0841ff5fbae972b685.tar.gz scummvm-rg350-3592690b7865bfc0b86dae0841ff5fbae972b685.tar.bz2 scummvm-rg350-3592690b7865bfc0b86dae0841ff5fbae972b685.zip  | |
Cleanup.
svn-id: r29441
Diffstat (limited to 'graphics/surface.cpp')
| -rw-r--r-- | graphics/surface.cpp | 19 | 
1 files changed, 6 insertions, 13 deletions
diff --git a/graphics/surface.cpp b/graphics/surface.cpp index 2b07af1ccb..ccf5523be0 100644 --- a/graphics/surface.cpp +++ b/graphics/surface.cpp @@ -28,27 +28,20 @@  namespace Graphics { -static void plotPoint1(int x, int y, int color, void *data) { +template<typename T> +static void plotPoint(int x, int y, int color, void *data) {  	Surface *s = (Surface *)data;  	if (x >= 0 && x < s->w && y >= 0 && y < s->h) { -		byte *ptr = (byte *)s->getBasePtr(x, y); -		*ptr = (byte)color; -	} -} - -static void plotPoint2(int x, int y, int color, void *data) { -	Surface *s = (Surface *)data; -	if (x >= 0 && x < s->w && y >= 0 && y < s->h) { -		uint16 *ptr = (uint16 *)s->getBasePtr(x, y); -		*ptr = (uint16)color; +		T *ptr = (T *)s->getBasePtr(x, y); +		*ptr = (T)color;  	}  }  void Surface::drawLine(int x0, int y0, int x1, int y1, uint32 color) {  	if (bytesPerPixel == 1) -		Graphics::drawLine(x0, y0, x1, y1, color, &plotPoint1, this); +		Graphics::drawLine(x0, y0, x1, y1, color, plotPoint<byte>, this);  	else if (bytesPerPixel == 2) -		Graphics::drawLine(x0, y0, x1, y1, color, &plotPoint2, this); +		Graphics::drawLine(x0, y0, x1, y1, color, plotPoint<uint16>, this);  	else  		error("Surface::drawLine: bytesPerPixel must be 1 or 2");  }  | 
