SCI: Moved gfx_line.cpp to line.h and turned _gfx_draw_line_buffer into a template

svn-id: r38905
This commit is contained in:
Max Horn 2009-02-26 16:16:22 +00:00
parent edc4e58c9c
commit 9515ae4ddc
2 changed files with 7 additions and 29 deletions

View File

@ -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:

View File

@ -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);