aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/gfx/gfx_support.cpp33
-rw-r--r--engines/sci/gfx/line.h (renamed from engines/sci/gfx/gfx_line.cpp)3
2 files changed, 7 insertions, 29 deletions
diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp
index 9768bf67ba..8480467774 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
index f992ac160c..e839bb46f0 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 <int PIXELWIDTH>
+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);