draws a line. takes two points. returns true if drew
| 24 | |
| 25 | // draws a line. takes two points. returns true if drew |
| 26 | void g3_DrawLine(ddgr_color color, g3Point *p0, g3Point *p1) { |
| 27 | uint8_t codes_or; |
| 28 | bool was_clipped = 0; |
| 29 | |
| 30 | if (p0->p3_codes & p1->p3_codes) |
| 31 | return; |
| 32 | |
| 33 | codes_or = p0->p3_codes | p1->p3_codes; |
| 34 | |
| 35 | if (codes_or) { |
| 36 | ClipLine(&p0, &p1, codes_or); |
| 37 | was_clipped = 1; |
| 38 | } |
| 39 | |
| 40 | if (!(p0->p3_flags & PF_PROJECTED)) { |
| 41 | g3_ProjectPoint(p0); |
| 42 | } |
| 43 | |
| 44 | if (!(p1->p3_flags & PF_PROJECTED)) { |
| 45 | g3_ProjectPoint(p1); |
| 46 | } |
| 47 | |
| 48 | rend_SetFlatColor(color); |
| 49 | rend_DrawLine(round(p0->p3_sx), round(p0->p3_sy), round(p1->p3_sx), round(p1->p3_sy)); |
| 50 | |
| 51 | // If was clipped, free temp points |
| 52 | if (was_clipped) { |
| 53 | if (p0->p3_flags & PF_TEMP_POINT) { |
| 54 | FreeTempPoint(p0); |
| 55 | } |
| 56 | |
| 57 | if (p1->p3_flags & PF_TEMP_POINT) { |
| 58 | FreeTempPoint(p1); |
| 59 | } |
| 60 | |
| 61 | // Make sure all temp points have been freed |
| 62 | CheckTempPoints(); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // draws a line based on the current setting of render states. takes two points. returns true if drew |
| 67 | void g3_DrawSpecialLine(g3Point *p0, g3Point *p1) { |
no test coverage detected