From 9515ae4ddca85993c159198bf033959c9aaed478 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 26 Feb 2009 16:16:22 +0000 Subject: [PATCH] SCI: Moved gfx_line.cpp to line.h and turned _gfx_draw_line_buffer into a template svn-id: r38905 --- engines/sci/gfx/gfx_support.cpp | 33 ++++-------------------- engines/sci/gfx/{gfx_line.cpp => line.h} | 3 ++- 2 files changed, 7 insertions(+), 29 deletions(-) rename engines/sci/gfx/{gfx_line.cpp => line.h} (94%) diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp index 9768bf67bac..8480467774c 100644 --- a/engines/sci/gfx/gfx_support.cpp +++ b/engines/sci/gfx/gfx_support.cpp @@ -29,30 +29,7 @@ #include "sci/gfx/gfx_system.h" #include "sci/gfx/gfx_tools.h" - -#define DRAWLINE_FUNC _gfx_draw_line_buffer_1 -#define PIXELWIDTH 1 -#include "gfx_line.cpp" -#undef PIXELWIDTH -#undef DRAWLINE_FUNC - -#define DRAWLINE_FUNC _gfx_draw_line_buffer_2 -#define PIXELWIDTH 2 -#include "gfx_line.cpp" -#undef PIXELWIDTH -#undef DRAWLINE_FUNC - -#define DRAWLINE_FUNC _gfx_draw_line_buffer_3 -#define PIXELWIDTH 3 -#include "gfx_line.cpp" -#undef PIXELWIDTH -#undef DRAWLINE_FUNC - -#define DRAWLINE_FUNC _gfx_draw_line_buffer_4 -#define PIXELWIDTH 4 -#include "gfx_line.cpp" -#undef PIXELWIDTH -#undef DRAWLINE_FUNC +#include "sci/gfx/line.h" namespace Sci { @@ -62,19 +39,19 @@ inline void gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth, Co switch (pixelwidth) { case 1: - _gfx_draw_line_buffer_1(buffer, linewidth, start, end, color); + _gfx_draw_line_buffer<1>(buffer, linewidth, start, end, color); return; case 2: - _gfx_draw_line_buffer_2(buffer, linewidth, start, end, color); + _gfx_draw_line_buffer<2>(buffer, linewidth, start, end, color); return; case 3: - _gfx_draw_line_buffer_3(buffer, linewidth, start, end, color); + _gfx_draw_line_buffer<3>(buffer, linewidth, start, end, color); return; case 4: - _gfx_draw_line_buffer_4(buffer, linewidth, start, end, color); + _gfx_draw_line_buffer<4>(buffer, linewidth, start, end, color); return; default: diff --git a/engines/sci/gfx/gfx_line.cpp b/engines/sci/gfx/line.h similarity index 94% rename from engines/sci/gfx/gfx_line.cpp rename to engines/sci/gfx/line.h index f992ac160c0..e839bb46f07 100644 --- a/engines/sci/gfx/gfx_line.cpp +++ b/engines/sci/gfx/line.h @@ -43,7 +43,8 @@ namespace Sci { memcpy(buffer + linewidth * (starty) + (startx), &color, PIXELWIDTH); -static inline void DRAWLINE_FUNC(byte *buffer, int linewidth, Common::Point start, Common::Point end, unsigned int color) { +template +void _gfx_draw_line_buffer(byte *buffer, int linewidth, Common::Point start, Common::Point end, unsigned int color) { int incrE, incrNE, d; int dx = ABS(end.x - start.x); int dy = ABS(end.y - start.y);