Pass canvas to g3_draw_line

This commit is contained in:
Kp 2017-02-11 21:42:33 +00:00
parent d779a26307
commit 47a319bba5
2 changed files with 6 additions and 5 deletions

View file

@ -39,7 +39,7 @@ static void must_clip_line(g3s_point *p0,g3s_point *p1,ubyte codes_or,const uint
; //line has already been clipped, so give up
else {
clip_line(p0,p1,codes_or,tp);
g3_draw_line(*p0, *p1, color, tp);
g3_draw_line(*grd_curcanv, *p0, *p1, color, tp);
}
//free temp points
@ -55,10 +55,10 @@ static void must_clip_line(g3s_point *p0,g3s_point *p1,ubyte codes_or,const uint
void g3_draw_line(g3s_point &p0, g3s_point &p1, const uint8_t color)
{
temporary_points_t tp;
g3_draw_line(p0, p1, color, tp);
g3_draw_line(*grd_curcanv, p0, p1, color, tp);
}
void g3_draw_line(g3s_point &p0,g3s_point &p1, const uint8_t color,temporary_points_t &tp)
void g3_draw_line(grs_canvas &canvas, g3s_point &p0, g3s_point &p1, const uint8_t color, temporary_points_t &tp)
{
ubyte codes_or;
@ -73,7 +73,7 @@ void g3_draw_line(g3s_point &p0,g3s_point &p1, const uint8_t color,temporary_poi
(static_cast<void>((p1.p3_flags & PF_PROJECTED) || (g3_project_point(p1), 0)), p1.p3_flags & PF_OVERFLOW)
)
return must_clip_line(&p0,&p1,codes_or,color,tp);
gr_line(*grd_curcanv, p0.p3_sx, p0.p3_sy, p1.p3_sx, p1.p3_sy, color);
gr_line(canvas, p0.p3_sx, p0.p3_sy, p1.p3_sx, p1.p3_sy, color);
}
#endif

View file

@ -31,6 +31,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "dsx-ns.h"
#include "maths.h"
#include "vecmat.h" //the vector/matrix library
#include "fwd-gr.h"
#include "compiler-array.h"
@ -263,7 +264,6 @@ static inline void g3_check_and_draw_tmap(const array<cg3s_point *, N> &pointlis
//draws a line. takes two points.
struct temporary_points_t;
void g3_draw_line(cg3s_point &p0,cg3s_point &p1, uint8_t color);
void g3_draw_line(cg3s_point &p0,cg3s_point &p1, uint8_t color,temporary_points_t &);
//draw a bitmap object that is always facing you
//returns 1 if off screen, 0 if drew
@ -302,6 +302,7 @@ public:
}
};
#else
void g3_draw_line(grs_canvas &, cg3s_point &p0, cg3s_point &p1, uint8_t color, temporary_points_t &);
constexpr std::size_t MAX_POINTS_IN_POLY = 100;
typedef void (*tmap_drawer_type)(const grs_bitmap &bm,uint_fast32_t nv,const g3s_point *const *vertlist);